#24546 [Ver->Bgs]: Object ID number does not increase
| From: | derick@php.net | Date: | Tue, 08 Jul 2003 20:26:52 +0000 |
| Subject: | #24546 [Ver->Bgs]: Object ID number does not increase | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-43480@lists.php.net to get a copy of this message | ||
ID: 24546
Updated by: derick@php.net
Reported By: proton at fangen dot net
-Status: Verified
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Irrelevant
PHP Version: 5CVS-2003-07-08 (dev)
New Comment:
This is not a bug, run this code and you'll see why:
<?php
class MyClass
{
function __destruct() {
echo "dtor\n";
}
}
function test()
{
$c = new MyClass();
print $c."\n"; // Will always print "Object id #1"
}
test();
test();
?>
Previous Comments:
------------------------------------------------------------------------
[2003-07-08 15:24:02] derick@php.net
I could reproduce this under linux (with beta1).
Derick
------------------------------------------------------------------------
[2003-07-08 15:14:43] proton at fangen dot net
Description:
------------
When creating an object, each created object should have a unique (zend
engine 2 internal) Object ID, right? The code below always prints
"Object id #1", i.e. the objects have the same ID. Although they are
instances of an empty (no methods or properties) class, I had the same
problem with classes that did have methods and/or properties.
Here's a short script that reproduces the problem:
Reproduce code:
---------------
class MyClass
{
}
function test()
{
$c = new MyClass();
print $c; // Will always print "Object id #1"
}
test();
test();
Expected result:
----------------
Object id #1
Object id #2
Actual result:
--------------
Object id #1
Object id #1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24546&edit=1