|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-05-15 08:42 UTC] 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 PatchesFix (last revision 2011-05-19 10:01 UTC by allesbesser at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 05:00:01 2025 UTC |
Any news about __{get,set}Static in the mainline?