From:             m dot kurzyna at crystalpoint dot pl
Operating system: PLD Linux
PHP version:      5.3CVS-2008-03-03 (snap)
PHP Bug Type:     Scripting Engine problem
Bug description:  Late static binding not working for variables

Description:
------------
Late static binding doesn't seem to apply to static class variables. 
Example is rather self explanatory (construtor using static keyword 
should increment variable in calling class).

Reproduce code:
---------------
<?php
        class B {
                static protected $counter = 0;
                
                public function __construct() {
                        ++static::$counter;
                        var_dump(static::$counter);
                }
        }

        class C extends B {
                public function __construct() {
                        ++static::$counter;
                        var_dump(static::$counter);
                }
        }

        new B;
        new C;
?>

Expected result:
----------------
int(1)
int(1)

Actual result:
--------------
int(1)
int(2)

-- 
Edit bug report at http://bugs.php.net/?id=44315&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44315&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44315&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44315&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44315&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44315&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44315&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44315&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44315&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44315&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44315&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44315&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44315&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44315&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44315&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44315&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44315&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44315&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44315&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44315&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44315&r=mysqlcfg

Reply via email to