From: jb2386 at hotmail dot com Operating system: Any PHP version: 5.2.6 PHP Bug Type: Class/Object related Bug description: __get() and __set() don't work for static variable calls
Description: ------------ As per bug report: http://bugs.php.net/bug.php?id=39678 "Static class attributes cannot be accessed using __get and __set methods." Also, for reference to "__callStatic" see: http://bugs.php.net/bug.php?id=26739 With the implementation of __callStatic in PHP 5.3, will there be an implementation of similar functions __getStatic() and __setStatic()? For example, so replacing __get and __set with __getStatic() and __setStatic() respectively will produce the "Expected Output" below? Reproduce code: --------------- class myClass { public function __set($name,$value) { echo "Setting: " . $name . " to " . $value."\n"; self::$$name = $value; } public function __get($name) { echo "Getting: " . $name . "\n"; } } myClass::$myStaticVar = "test"; echo myClass::$myStaticVar; Expected result: ---------------- Setting: myStaticVar to test Getting: myStaticVar Actual result: -------------- Fatal error: Access to undeclared static property: myClass::$myStaticVar -- Edit bug report at http://bugs.php.net/?id=45002&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45002&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45002&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45002&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45002&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45002&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45002&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45002&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45002&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45002&r=support Expected behavior: http://bugs.php.net/fix.php?id=45002&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45002&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45002&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45002&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45002&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45002&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45002&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45002&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45002&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45002&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45002&r=mysqlcfg