1--TEST-- 2Bug #71018 (ReflectionProperty::setValue() behavior changed) 3--FILE-- 4<?php 5class T1 { 6 public static $data; 7 8 public static function getDataBySelf() 9 { 10 return self::$data; 11 } 12 13 public static function getDataByStatic() 14 { 15 return static::$data; 16 } 17} 18 19class T2 extends T1 {} 20 21$Prop1 = new ReflectionProperty(T1::class, 'data'); 22$Prop2 = new ReflectionProperty(T2::class, 'data'); 23 24// #1 25// prints: hello, hello in PHP5, but world, hello in PHP7 - not OK 26$Prop1->setValue(\T1::class, "world"); 27$Prop2->setValue(\T2::class, 'hello'); 28var_dump("T2::self = " . T2::getDataBySelf()); 29var_dump("T2::static = " . T2::getDataByStatic()); 30 31// #2 32// prints: hello, hello in both PHP5 and PHP7 - OK 33T1::$data = "world"; 34T2::$data = 'hello'; 35 36var_dump("T2::self = " . T2::getDataBySelf()); 37var_dump("T2::static = " . T2::getDataByStatic()); 38?> 39--EXPECT-- 40string(16) "T2::self = hello" 41string(18) "T2::static = hello" 42string(16) "T2::self = hello" 43string(18) "T2::static = hello" 44