1--TEST-- 2static variables in methods inherited from parent class (can't cache objects) 3--FILE-- 4<?php 5class C { 6 function foo ($y = null) { 7 static $x = null; 8 if (!is_null($y)) { 9 $x = [$y]; 10 } 11 return $x; 12 } 13} 14$c = new C(); 15$c->foo(new stdClass); 16$d = new class extends C {}; 17var_dump($d->foo()); 18var_dump($d->foo(24)); 19var_dump($c->foo()); 20?> 21--EXPECT-- 22array(1) { 23 [0]=> 24 object(stdClass)#2 (0) { 25 } 26} 27array(1) { 28 [0]=> 29 int(24) 30} 31array(1) { 32 [0]=> 33 int(24) 34} 35