#33626 [Opn->Csd]: Object comparison diverges from PHP 4 to 5
| From: | vrana@php.net | Date: | Thu, 14 Jul 2005 10:04:34 +0000 |
| Subject: | #33626 [Opn->Csd]: Object comparison diverges from PHP 4 to 5 | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969369113@lists.php.net to get a copy of this message | ||
ID: 33626
Updated by: vrana@php.net
Reported By: andrebacci dot listas at gmail dot com
-Status: Open
+Status: Closed
Bug Type: Documentation problem
PHP Version: 5.0.4
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Link to PHP 5 object comparison to table 15-4.
Previous Comments:
------------------------------------------------------------------------
[2005-07-10 16:00:36] andrebacci dot listas at gmail dot com
http://www.php.net/manual/en/language.operators.comparison.php
Table 15-4, table 15-5, example 15-2 and no mention to BC in PHP 4 to
5.
------------------------------------------------------------------------
[2005-07-10 09:05:57] tony2001@php.net
http://www.php.net/manual/en/language.oop5.object-comparison.php
------------------------------------------------------------------------
[2005-07-10 06:32:12] andrebacci dot listas at gmail dot com
http://news.php.net/php.internals/17211
------------------------------------------------------------------------
[2005-07-10 01:15:12] andrebacci dot listas at gmail dot com
Description:
------------
Object comparison differs from PHP 4 to 5.
From docs
http://www.php.net/manual/en/language.operators.comparison.php:
Table 15-5. Comparison with Different Types
object
object
Built-in classes can define its own comparison, different classes are
uncomparable, same class - compare properties the same way as arrays.
In my machine works as in docs:
andre@macrossv:~/temp$ php -v
PHP 4.3.10-10ubuntu4 (cli) (built: Apr 1 2005 14:16:27)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
In pythonic friend's machine, no:
~> php -v
PHP 5.0.4 (cli) (built: Jul 7 2005 20:27:16)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies
Reproduce code:
---------------
<?php
class Foo { var $bar = 1; }
$a = new Foo;
$b = new Foo;
//var_dump($a);
//var_dump($b);
echo $a == $b ? "True\n" : "False\n";
echo $a === $b ? "True\n" : "False\n";
?>
Expected result:
----------------
True
True
Actual result:
--------------
True
False
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33626&edit=1