|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-04-03 22:19 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2016-04-03 22:19 UTC] requinix@php.net
[2016-04-09 08:28 UTC] mika018 at gmail dot com
-: michael dot bilcot at gmail dot com
+: mika018 at gmail dot com
[2016-04-09 08:28 UTC] mika018 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ When you call parent::method() and there is a static variable in this, the value returned to all inherited objects is the same Test script: --------------- class A { function a() { static $i; if (!$i) { $i = $this->value; } return $i; } } class B extends A { public $value = 'B'; } class C extends A { public $value = 'C'; function a() { return parent::a(); } } $b = new B; echo $b->a(); $c = new C; echo $c->a(); Expected result: ---------------- BC Actual result: -------------- BB