note 103023 deleted from language.oop5.late-static-bindings by thiago
| From: | thiago@php.net | Date: | Mon, 21 Mar 2011 14:06:17 +0000 |
| Subject: | note 103023 deleted from language.oop5.late-static-bindings by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-178044@lists.php.net to get a copy of this message | ||
Note Submitter: vk
----
Unexpected features:
<?php
class A{
protected static $bar='A';
function foo(){
echo static::$bar;
}
}
class B extends A{
protected static $bar='B';
}
B::foo();
?>
Will output: B
BUT:
<?php
class A{
protected static $bar='A';
function foo(){
echo static::$bar;
}
}
class B extends A{
protected static $bar='B';
}
//Added
class C{
function __construct(){
B::foo();
}
}
$C = new C();
?>
Will produce:
Fatal error: Access to undeclared static property: C::$bar in file on line 5