Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

ZendDeveloper + simpleXml #159

Closed
llpereiras opened this issue Jul 29, 2014 · 12 comments
Closed

ZendDeveloper + simpleXml #159

llpereiras opened this issue Jul 29, 2014 · 12 comments
Assignees
Milestone

Comments

@llpereiras
Copy link

in this line

return simplexml_load_string($str);
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in C:\wamp\www\aprendacerto\vendor\ZendDeveloperTools\src\ZendDeveloperTools\Collector\DbCollector.php on line 136
( ! ) Exception: Serialization of 'SimpleXMLElement' is not allowed in C:\wamp\www\aprendacerto\vendor\ZendDeveloperTools\src\ZendDeveloperTools\Collector\DbCollector.php on line 136
@Ocramius Ocramius self-assigned this Jul 29, 2014
@Ocramius
Copy link
Member

@ze-pequeno where is that return statement?

@llpereiras
Copy link
Author

I go try add more information.
In my model class, i add this method.

private function stringToXml($str)
{
    if(!$str)
        return;
    return simplexml_load_string($str);
}

when the ZendDeveloperTools is active in my Module.php, i receveid this error:

Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' 
is not allowed' in mywebsite\vendor\ZendDeveloperTools\src\ZendDeveloperTools\Collector\DbCollector.php on line 136

@Ocramius
Copy link
Member

This is indeed a problem: I most probably have to split out the serialization tools into a small separate lib that can serialize all internal PHP classes, or at least stub them.

@moderndeveloperllc
Copy link
Contributor

@Ocramius Sorry for being dense. It's been quite a while since I looked at all this code. Why is the profiler being serialized? Would something as simple as json_encode() fix this?

@Ocramius
Copy link
Member

Ocramius commented Jan 9, 2015

@moderndeveloperllc the profiler is being serialized to keep a snapshot of the data at the time where is relevant for us (to see what's going on). If that doesn't happen, then it is not possible to dump accurate information.

@moderndeveloperllc
Copy link
Contributor

I guess the question is if further development should be done on this repo, or just have folks focus issues/PRs on Roave/RoaveDeveloperTools as you already solved this issue there with ObjectStub et al.

@Ocramius
Copy link
Member

Ocramius commented Jan 9, 2015

@moderndeveloperllc I'd rather fix it here and add a test there (should already work).

Yes, Roave/RoaveDeveloperTools will supersede this repo, but I don't have time for it right now.

@seyfer
Copy link
Contributor

seyfer commented May 6, 2015

I have the same error right now.

@seyfer
Copy link
Contributor

seyfer commented May 6, 2015

It can be fixed with something like that wrapping, but I don't know exactly where in code

if ($var instanceof \SimpleXmlElement)
{
 $var = var_export($var);
}

@seyfer
Copy link
Contributor

seyfer commented May 6, 2015

My error full text.

Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in /var/www/sss.com/vendor/zendframework/zend-developer-tools/src/ZendDeveloperTools/Profiler.php on line 212
( ! ) Exception: Serialization of 'SimpleXMLElement' is not allowed in /var/www/sss.com/vendor/zendframework/zend-developer-tools/src/ZendDeveloperTools/Profiler.php on line 212

And code at this place strange
https://github.com/zendframework/ZendDeveloperTools/blob/master/src/ZendDeveloperTools/Profiler.php#L212

$this->report->addCollector(unserialize(serialize($collector)));

@seyfer seyfer mentioned this issue May 6, 2015
@seyfer
Copy link
Contributor

seyfer commented May 6, 2015

I am just removed unserialize(serialize()) and that do the trick, all works now.

Ocramius added a commit that referenced this issue May 6, 2015
@Ocramius Ocramius modified the milestone: 1.0.0-RC1 Oct 30, 2015
@Ocramius
Copy link
Member

Was handled in #190

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants