Re: == object comparison bug?

From: Date: Sun, 02 May 2004 15:40:56 +0000
Subject: Re: == object comparison bug?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-9630@lists.php.net to get a copy of this message
Thanks for the detailed report. This should be fixed in the latest CVS. Andi At 01:25 PM 4/28/2004 -0400, Hans Lellelid wrote:
I'm using PHP5.0.0RC2. I saw that there was a similar question posted, but apparently that issue had already been fixed. ---code---------------------------- class File {
        public $var;
        function __construct($val) {
                $this->var = $val;
        }
} $t1 = new File("test"); $t2 = new File("test"); print_r($t1); print_r($t2); print "\$t1 == \$t2 ?"; if ($t1 == $t2) {
        print "YES\n";
} else {
        print "NO\n";
} ---output---------------------------- File Object (
    [var] => test
) File Object (
    [var] => test
) $t1 == $t2 ? Notice: Object of class File could not be converted to integer in /var/www/apps/ddi/test.php on line 18 Notice: Object of class File could not be converted to integer in /var/www/apps/ddi/test.php on line 18 YES I don't know why anything is being coverted to an _integer_. Is this intended behavior? If so, how do I do a PHP4-style object contents comparison? Using === doesn't produce any notice, but also means something very different of course. Hans -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#9630) next »