#28443 [NEW]: Var is changed without a reason

From: Date: Wed, 19 May 2004 07:28:57 +0000
Subject: #28443 [NEW]: Var is changed without a reason
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59767@lists.php.net to get a copy of this message
From: nitz at framingo dot de Operating system: Win2k PHP version: 4.3.6 PHP Bug Type: Class/Object related Bug description: Var is changed without a reason Description: ------------ Class constructor sets a var to a value that is only assigned to an other var. Reproduce code: --------------- <?php class FG_Timestamp{ var $timestamp; var $limit; function FG_Timestamp($ts=-1) { $this->$timestamp=0; $this->$limit=1; echo "1 val limit=".$this->$limit."<br>"; if ($ts<0) $this->$timestamp=time(); else $this->$timestamp=2; echo "2 val limit=".$this->$limit."<br>"; } } $cmp=new FG_Timestamp(0); ?> Expected result: ---------------- 1 val limit=1 2 val limit=1 Actual result: -------------- 1 val limit=1 2 val limit=2 -- Edit bug report at http://bugs.php.net/?id=28443&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28443&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28443&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28443&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28443&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28443&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28443&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28443&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28443&r=support Expected behavior: http://bugs.php.net/fix.php?id=28443&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28443&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28443&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28443&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28443&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28443&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28443&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28443&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28443&r=float

« previous php.bugs (#59767) next »