<?php
class Base
{
public static $prop = 'BASE';
}
class Mock extends Base
{
}
$excepted = 'REFLECTED';
$property = new ReflectionProperty('Base', 'prop');
$property->setValue($excepted);
echo "Should be $excepted and is {Base::$prop}\n";
echo "Should be $excepted and is {Mock::$prop}\n";
Deprecated: Calling ReflectionProperty::setValue() with a single argument is deprecated in /in/i8Z1J on line 16
Warning: Undefined variable $prop in /in/i8Z1J on line 18
Should be REFLECTED and is {Base::}
Warning: Undefined variable $prop in /in/i8Z1J on line 19
Should be REFLECTED and is {Mock::}
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Deprecated: Calling ReflectionProperty::setValue() with a single argument is deprecated in /in/i8Z1J on line 16
Warning: Undefined variable $prop in /in/i8Z1J on line 18
Should be REFLECTED and is {Base::}
Warning: Undefined variable $prop in /in/i8Z1J on line 19
Should be REFLECTED and is {Mock::}
Warning: Undefined variable $prop in /in/i8Z1J on line 18
Should be REFLECTED and is {Base::}
Warning: Undefined variable $prop in /in/i8Z1J on line 19
Should be REFLECTED and is {Mock::}
Notice: Undefined variable: prop in /in/i8Z1J on line 18
Should be REFLECTED and is {Base::}
Notice: Undefined variable: prop in /in/i8Z1J on line 19
Should be REFLECTED and is {Mock::}
Output for 7.3.32 - 7.3.33
Should be REFLECTED and is {Base::}
Should be REFLECTED and is {Mock::}