<?php
class Test {
private $a='data';
protected $b=123;
public $c=true;
}
$a = new Test;
$hydrated = (new ReflectionFunction('get_object_vars'))->getClosure()->bindTo($a, 'Test');
$data = $hydrated($a);
var_dump($data);
Warning: Cannot rebind scope of closure created from function in /in/qOg6k on line 12
Fatal error: Uncaught Error: Value of type null is not callable in /in/qOg6k:13
Stack trace:
#0 {main}
thrown in /in/qOg6k on line 13
Process exited with code 255.
Output for 7.4.14 - 7.4.33
Warning: Cannot rebind scope of closure created from function in /in/qOg6k on line 12
Fatal error: Uncaught Error: Function name must be a string in /in/qOg6k:13
Stack trace:
#0 {main}
thrown in /in/qOg6k on line 13
Process exited with code 255.
Warning: Cannot rebind scope of closure created by ReflectionFunctionAbstract::getClosure() in /in/qOg6k on line 12
Fatal error: Uncaught Error: Function name must be a string in /in/qOg6k:13
Stack trace:
#0 {main}
thrown in /in/qOg6k on line 13
Process exited with code 255.
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/qOg6k on line 12
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/qOg6k on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/qOg6k on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/qOg6k on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/qOg6k on line 4
Process exited with code 255.