#44315 [Opn]: Late static binding not working for variables

From: Date: Mon, 03 Mar 2008 01:31:17 +0000
Subject: #44315 [Opn]: Late static binding not working for variables
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-122847@lists.php.net to get a copy of this message
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

« previous php.bugs (#122847) next »