ID: 47620
Updated by: [email protected]
Reported By: olemarkus dot with at student-media dot no
Status: Open
Bug Type: Class/Object related
Operating System: Linux
PHP Version: 5.3CVS-2009-03-11 (snap)
New Comment:
And here is the code:
<?php
namespace A {
class A {
function __construct() {
echo \C\C::getName() . "\n";
}
}
}
namespace B {
abstract class B {
static protected $name = '';
function getName() {
return static::$name;
}
}
}
namespace C {
class C extends \B\B {
static protected $name = 'C';
}
}
namespace {
echo \C\C::getName() . "\n";
$a = new \A\A();
}
?>
Previous Comments:
------------------------------------------------------------------------
[2009-03-11 07:18:24] olemarkus dot with at student-media dot no
Description:
------------
When using static:: in a parent class to refer to the child class that
was called, the keyword is resolved to the caller class instead.
Reproduce code:
---------------
http://olemarkus.com/issue.txt
Expected result:
----------------
I expect both calls to \C\C::getName() to yield the same result:
C
C
Actual result:
--------------
The second one gives the following output:
C
Fatal error: Access to undeclared static property: A\A::$name in
issue.php on line 13
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47620&edit=1