#28892 [Opn]: Object id that's still in use gets reassigned
| From: | paranoid at pcwereld dot be | Date: | Thu, 24 Jun 2004 08:38:28 +0000 |
| Subject: | #28892 [Opn]: Object id that's still in use gets reassigned | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61223@lists.php.net to get a copy of this message | ||
ID: 28892
User updated by: paranoid at pcwereld dot be
Reported By: paranoid at pcwereld dot be
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Windows 2k
PHP Version: 5.0.0RC3
New Comment:
When using new C($a = new A()) instead of new C(new A()) the code seems
to work like expected.
Previous Comments:
------------------------------------------------------------------------
[2004-06-23 12:59:04] paranoid at pcwereld dot be
Description:
------------
PHP reassigns an allready-in-use object id to a newly created object,
after the first object (that loses it's id) was removed from an array,
but was still referenced in another object.
Reproduce code:
---------------
http://users.pandora.be/paranet/poc.html
Expected result:
----------------
I expected that object C would still contain a reference to the first A
object (A-1) i created, ...
Actual result:
--------------
(see comments in code for the actual output)
... instead A-1 was overwritten with a second A object (A-2) i created,
that (!!!!!) used the same object id as the first A object.
PHP seems to be missing the fact that A-1 is still referenced inside
the C object, and thus assigns the object id A-1 was using to A-2
Removing the part marked "important" in list_remove results in a normal
behaviour, eg. C refers to A-1, not A-2. And A-2 doesn't get the same
object id as A-1. The bug is probably somewhere in the code that
removes an object from an array.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28892&edit=1