|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-11-16 00:12 UTC] felipe@php.net
-Package: Variables related
+Package: Scripting Engine problem
[2011-12-27 10:10 UTC] stas@php.net
-Status: Open
+Status: Bogus
[2011-12-27 10:10 UTC] stas@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Mar 24 02:00:01 2026 UTC |
Description: ------------ If I call method of the class "B" that implements class "A" that uses static, under some class "C" it tries to get static property of the "C", but not of the "B". And if I try to call B::inst() not under some class it works fine. Test script: --------------- class A { public static $_a = null; private function __construct() {} private function __clone() {} public function inst() { if (is_null(static::$_a)) { static::$_a = new static(); } return static::$_a; } } class B extends A { } class C { public function __construct() { B::inst(); } } Expected result: ---------------- B::$_a Actual result: -------------- Fatal error: Access to undeclared static property: C::$_a