#36487 [Bgs->Opn]: object === same object mismatch
| From: | cweiske@php.net | Date: | Thu, 23 Feb 2006 09:16:39 +0000 |
| Subject: | #36487 [Bgs->Opn]: object === same object mismatch | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-93560@lists.php.net to get a copy of this message | ||
ID: 36487
Updated by: cweiske@php.net
Reported By: xxoes at nw7 dot de
-Status: Bogus
+Status: Open
Bug Type: *General Issues
Operating System: windows & linux
PHP Version: 5.1.2
New Comment:
As far as I see that, the objects *are* identical.
They equal === as long as they are not in the process of being
destroyed - but as soon as the destroying process is begun, they don't
equal any more although they are still equal
Previous Comments:
------------------------------------------------------------------------
[2006-02-23 08:05:56] xxoes at nw7 dot de
Sorry but i don't understand!
Thats are the same objects and the same instances, and === doesn't
matched!
It works fine if a call $obj->__destruct === is true, but not if this
function is called by php on exit.
------------------------------------------------------------------------
[2006-02-22 16:42:39] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
For === to return true on object comparison both objects must be
instances of the same class and refer to the exact same internal
object.
------------------------------------------------------------------------
[2006-02-22 15:04:40] xxoes at nw7 dot de
This is not PHP-GTK related.
If you replace GtkObject with DOMElement you get the same result.
------------------------------------------------------------------------
[2006-02-22 14:33:03] xxoes at nw7 dot de
Description:
------------
Although the objects have the same object id after destruction, "==="
doesn't equal them any more.
I try:
$abc = new abc();
$obj = new bla();
and:
$abc = new abc();
$obj = new bla();
both the same result.
This does not happen when you remove "extends GtkObject" from the class
signature.
Reproduce code:
---------------
<?PHP
class bla extends GtkObject {
public $xparent;
function __construct() {
}
function __destruct() {
echo "bla::__destruct()\r\n";
$this->xparent->remove($this);
}
}
class abc {
function __destruct() {
echo "abc::__destruct()\r\n";
}
function put($obj) {
$this->obj = $obj;
$obj->xparent = $this;
}
function remove($obj) {
echo "Object matched?: ".($this->obj === $obj)."\r\n";
echo $this->obj." ".$obj."\r\n";
}
}
$abc = new abc();
$obj = new bla();
$abc->put($obj);
?>
Expected result:
----------------
That the operation $this->obj === $obj is true.
Actual result:
--------------
$this->obj and $obj mismatch.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=36487&edit=1