ID:               45002
 Comment by:       cleeder at gmail 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:

How long until we can expect to see this patch in the production
version of PHP?


Previous Comments:
------------------------------------------------------------------------

[2008-09-13 14:42:23] [EMAIL PROTECTED]

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

Reply via email to