ID: 45002 Comment by: some at email dot com Reported By: jb2386 at hotmail dot com Status: Open Bug Type: Feature/Change Request Operating System: Any PHP Version: 5.2.6 New Comment:
When to expect resolving this bug Previous Comments: ------------------------------------------------------------------------ [2009-05-13 15:38:49] rcavallari at hotmail dot com Any news about __{get,set}Static in the mainline? ------------------------------------------------------------------------ [2009-01-08 08:51:30] jeremie dot bordier at gmail dot com Could this patch be reviewed and committed ? It's been a long time now for a such little feature... ------------------------------------------------------------------------ [2008-11-25 03:50:55] cleeder at gmail dot com How long until we can expect to see this patch in the production version of PHP? ------------------------------------------------------------------------ [2008-09-13 14:42:23] the...@php.net There is a patch available at http://sitten-polizei.de/php/getstatic.diff ------------------------------------------------------------------------ [2008-05-15 08:42:05] jb2386 at hotmail dot com 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 this bug report at http://bugs.php.net/?id=45002&edit=1