#25167 [NEW]: Variable get overwritten inside class

From: Date: Wed, 20 Aug 2003 07:59:05 +0000
Subject: #25167 [NEW]: Variable get overwritten inside class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46286@lists.php.net to get a copy of this message
From: bakkerl at lamp dot xs4all dot nl Operating system: RedHat 9 PHP version: 4.3.2 PHP Bug Type: Class/Object related Bug description: Variable get overwritten inside class Description: ------------ A class which contains more than 1 variable, all varible gets the same values. The all get the value of the last value assinging. Reproduce code: --------------- <?php class test { var $a; var $b; function test() { $this->$a = "Hello"; $this->$b = "World!"; } function showWorld() { echo $this->$a." ".$this->$b; } } ?> Expected result: ---------------- After calling showWorld() i would expect to see: "Hello World!". Actual result: -------------- After calling showWorld() i got: "World! World!" -- Edit bug report at http://bugs.php.net/?id=25167&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25167&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25167&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25167&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25167&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25167&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25167&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25167&r=support Expected behavior: http://bugs.php.net/fix.php?id=25167&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25167&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25167&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25167&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25167&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25167&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25167&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25167&r=gnused

« previous php.bugs (#46286) next »