copying objects, a bug ?

From: Date: Wed, 05 Jul 2000 11:57:24 +0000
Subject: copying objects, a bug ?
Groups: php.general 
Request: Send a blank email to php-general+get-4915@lists.php.net to get a copy of this message
Hi, I think I found a bug but I want to ask You before I sumit anything. Here is fragment of code that I think makes wrong results: <? [...] $bday = $caday; echo "status before exchange".$bday -> visits[0] -> status."<br>"; $schedule -> exchangedays($caday); echo "status after exchange".$bday -> visits[0] -> status."<br>"; ?> $caday,$bday and $schedule are objects and has complicated structure. Result is: status before exchange: 6 status after exchange: 3 Why? exchangedays() operates on $caday so It shouldn't change any data in copy of that object $bday. I can't find anything wrong in the code. I don't use references to objects as arguments in methods (&$var) so all methods operate on their internal copies. Can you tell me what else could cause this behaviour ? Thanks for any help. Łukasz Michalski zork@clan.pl

« previous php.general (#4915) next »