ID:               44315
 User updated by:  m dot kurzyna at crystalpoint dot pl
 Reported By:      m dot kurzyna at crystalpoint dot pl
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: PLD Linux
 PHP Version:      5.3CVS-2008-03-03 (snap)
 New Comment:

The snapshot used was php-5.3-2008-03-02-21:30.


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

[2008-03-03 01:18:47] m dot kurzyna at crystalpoint dot pl

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 this bug report at http://bugs.php.net/?id=44315&edit=1

Reply via email to