#33626 [NEW]: Object comparison diverges from PHP 4 to 5
| From: | andrebacci dot listas at gmail dot com | Date: | Sat, 09 Jul 2005 23:15:13 +0000 |
| Subject: | #33626 [NEW]: Object comparison diverges from PHP 4 to 5 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-81624@lists.php.net to get a copy of this message | ||
From: andrebacci dot listas at gmail dot com
Operating system:
PHP version: 5.0.4
PHP Bug Type: Class/Object related
Bug description: Object comparison diverges from PHP 4 to 5
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 bug report at http://bugs.php.net/?id=33626&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33626&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33626&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33626&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33626&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33626&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33626&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33626&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33626&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33626&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33626&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33626&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33626&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33626&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33626&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33626&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33626&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33626&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33626&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33626&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33626&r=mysqlcfg