ZF2-544: Collection extract method updates targetElement object to an existing value

Description

Collection extract method updates targetElement object property into an existing value. This will cause a lot of problems if adding new elements is allowed.

In extract method foreach cluase current code: $this->targetElement->object = $value; $values[$key] = $this->targetElement->extract();

It should be something like this: $prevValue = $this->targetElement->object; $this->targetElement->object = $value; $values[$key] = $this->targetElement->extract(); $this->targetElement->object = $prevValue;

If this is not done, targetElement will have values from the last object that was in the list - for example ID.

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2574