Issues

ZF2-144: Zend\Stdlib\PriorityQueue clone problem

Description

When cloning Zend\Stdlib\PriorityQueue its property queue is not cloned so all cloned objects will have same queue object. This will couse double execution of event listeners in some cases for EventManager and probably lots of other problems in other components.

Comments

Fix

When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties. Any properties that are references to other variables, will remain references.

Thus your patch is not correct, as the references in the $items property will remain references.

I have created a pull request with a proper patch: https://github.com/zendframework/zf2/pull/973

Actually, you were right.

Yes couse you can`t unserialize(serialize()) on \SplPriorityQueue object. Also, most important, I want only references cloned not whole objects(deep copy would be incorrect in this case from my perspective).

Yes, you were right. I have updated the pull request, to reflect those changes.

Issue has been merged into master, and can be closed. Thank you for your feedback.

https://github.com/zendframework/zf2/…

Accidently clicked "close issue" instead of "resolve issue". Resolving now.