ID: 28442 Updated by: [EMAIL PROTECTED] Reported By: kell_pt at users dot sf dot net -Status: Open +Status: Closed Bug Type: Zend Engine 2 problem Operating System: * PHP Version: 5.0.3 Assigned To: helly New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. The static constructor in the example above would be an interesting feature request, feel free to open it as a new bug. Previous Comments: ------------------------------------------------------------------------ [2005-03-10 14:17:49] [EMAIL PROTECTED] Your code assumption is not fully correct. A static variable will be inherited unless not defined again. However this 'unless' part is wrong, it rsults in a compiler error. ------------------------------------------------------------------------ [2005-03-06 22:10:51] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2004-05-22 04:17:45] kell_pt at users dot sf dot net Secondly, there have been more bug reports regarding this issue, or different effects of the model. Anyone having programmed in other enviroments where class inheritance is possible will not feel at home with this, and also it doesn't add anything to the language - it is not only a limitation, but also misleading behaviour. We'd like to see a bit more discussion on this, it *really* isn't a bogus problem. :) Cheers, and I apologize for the insistence, but we're using PHP5 for its new OO features, and it's being hard to cope with the fact that this seems to be overlooked. Hopefully it will be fixed (can't see a reason why it wouldn't). Cheers. ------------------------------------------------------------------------ [2004-05-22 04:13:56] kell_pt at users dot sf dot net It most certainly isn't. Declaring a variable as private static just hides the variable from outside the class. It also allows subclasses to redeclare it. But it doesn't change a thing, and that's not the intended behaviour. An example: class ClassA { private static $cn; public static function setName( $cn ) { self::$cn = $cn; } public static function getName( ) { return self::$cn; } } class ClassB extends ClassA { private static $cn; // with or without this, result is the same } ClassA::setName( 'AAA' ); ClassB::setName( 'BBB' ); print( ClassA::getName() . "\n" ); // prints 'BBB' print( ClassB::getName() . "\n" ); // prints 'BBB' ClassB::setName() is using ClassA as self, when that's not the intended nor propper behaviour. If you call a method on ClassB, it has to affect ClassB, not ClassA - that's how $this works on instances, that's how it should work on static classes. Secondly, ------------------------------------------------------------------------ [2004-05-21 18:12:34] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php What you want is \'private static\' ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/28442 -- Edit this bug report at http://bugs.php.net/?id=28442&edit=1