From: dan at wep dot net Operating system: Linux (Redhat 9, 2.4.22) PHP version: 5CVS-2003-10-09 (dev) PHP Bug Type: Class/Object related Bug description: __get & __set will not fire if the object contains reference to variable
Description: ------------ When a class definition contains any reference to a variable name that will be later used in a __set() (or __get()) operation, the setter (or getter) will not fire. This variable does not have to be defined or used at all. The code must simply exist. In the following example code, simply comment out the print($this->myVar); line and you will see the 'setter fired' message. This is NOT similar to bug #24608 as the element never gets created in this case. Reproduce code: --------------- class test { function unusedFunction() { print($this->myVar); } function __set($nm, $vl) { print('setter fired'); } } $obj = new test(); $obj->myVar = 'some data'; Expected result: ---------------- 'setter fired' Actual result: -------------- Nothing. -- Edit bug report at http://bugs.php.net/?id=25815&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25815&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25815&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25815&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25815&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25815&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25815&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25815&r=support Expected behavior: http://bugs.php.net/fix.php?id=25815&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25815&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25815&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25815&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25815&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25815&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25815&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25815&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25815&r=float