ZendDeveloper + simpleXml
llpereiras opened this issue · 12 comments
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
@ze-pequeno where is that return
statement?
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
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.
@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?
@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.
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.
@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.
I have the same error right now.
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);
}
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)));
I am just removed unserialize(serialize())
and that do the trick, all works now.