1--TEST-- 2Behavior of static variable in private trait method 3--FILE-- 4<?php 5 6trait T { 7 private static function method() { 8 static $x; 9 if ($x === null) $x = new stdClass; 10 return $x; 11 } 12 13 public static function method2() { 14 return self::method(); 15 } 16} 17 18class C { 19 use T; 20} 21 22var_dump(C::method2()); 23 24class D extends C { 25 use T; 26} 27 28var_dump(D::method2()); 29 30?> 31--EXPECT-- 32object(stdClass)#1 (0) { 33} 34object(stdClass)#2 (0) { 35} 36