Re: toString() and Object #ID

From: Date: Sat, 14 Jul 2007 23:05:20 +0000
Subject: Re: toString() and Object #ID
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-30941@lists.php.net to get a copy of this message
Hi Pavel, Pavel Shevaev wrote:
Folks, is this really wanted behavior? Because if so, why does the following result in the same hash as well(PHP-5.2.1)? $ php -r "class Foo{};$foo = new Foo();var_dump(spl_object_hash($foo));$foo->bar = 1;var_dump(spl_object_hash($foo));" string(32) "d1f40a1cc04d8c79d09ae6262666adbb" string(32) "d1f40a1cc04d8c79d09ae6262666adbb"
Because you calculate the hash for the same object. It does not matter, that you changed a property, the $foo is still the same object. Best regards, Stephan

« previous php.internals (#30941) next »