#39530 [NEW]: __set is not called

From: Date: Thu, 16 Nov 2006 09:45:16 +0000
Subject: #39530 [NEW]: __set is not called
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-105059@lists.php.net to get a copy of this message
From: g42 at gmx dot net Operating system: Linux PHP version: 5.2.0 PHP Bug Type: Class/Object related Bug description: __set is not called Description: ------------ __set is not called if the property is called by reference Reproduce code: --------------- <?php class Test { private $properties; function __construct() { $this->properties = array(); } function __set($name, $value) { echo "setting $name\n"; $this->properties[$name] = $value; } function __get($name) { echo "getting $name\n"; return ($this->properties[$name]); } } $test = new Test; $test->array = array("foo"); array_push($test->array, "bar"); print_r($test->array); ?> Expected result: ---------------- setting property getting property setting property getting property Array ( [0] => foo [1] => bar ) Actual result: -------------- setting property getting property getting property Array ( [0] => foo [1] => bar ) -- Edit bug report at http://bugs.php.net/?id=39530&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39530&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39530&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39530&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39530&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39530&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39530&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39530&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39530&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39530&r=support Expected behavior: http://bugs.php.net/fix.php?id=39530&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39530&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39530&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39530&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39530&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39530&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39530&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39530&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39530&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39530&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39530&r=mysqlcfg

« previous php.bugs (#105059) next »