ZF-10448: Cache Zend_Navigation not working
Description
Dears,
This issue is more or less the same as ZF-6746.
Since Zend_Navigation use spl_object_hash to generate an id for the page, if you cache a Zend_Navigation object, once the cache is loaded, the navigation is broken because spl_object_hash generation unique id for the instance of php. See also http://stackoverflow.com/questions/1370130/…
Possible fix (to test): don't use spl_object_id but md5(serialize(array(...))) representing the object. The active property must be saved as false and the parents property must be saved as null because the parents may changed once you add a page.
I will join the patch but should be improved and well tested.
Thank you for your hard work on the Zend Framework.
Best regards,
Raphaël Dehousse
Comments
Posted by Raphael Dehousse (thymus) on 2010-09-14T03:56:34.000+0000
Really strange, I cannot add a file (don't see any link to do that)
I paste the patch here then
Best regards,
Raphaël Dehousse
Posted by Kai Uwe (kaiuwe) on 2011-07-05T14:21:57.000+0000
Bad idea!
Fail!
Posted by Kai Uwe (kaiuwe) on 2011-07-05T16:20:20.000+0000
Maybe the www.php.net/manual/en/class.splobjectstorage.php" rel="nofollow">SplObjectStorage class is a possible variant. I will look into this (including the performance).
Posted by Raphael Dehousse (thymus) on 2011-07-12T15:09:59.000+0000
Hello,
The user would have to define a different id for the page then. Sth has to be different between the pages, otherwise, what could be the interest?
Thank you for looking for a solution ;)
Regards,
Raphaël Dehousse
Posted by Frank Brückner (frosch) on 2011-08-13T17:05:57.000+0000
{quote} Sth has to be different between the pages, otherwise, what could be the interest? {quote} It breaks the test from "Zend_Navigation_ContainerTest":
;)