<?php
class x { public function method() { var_dump($this); } }
$o = new x;
$r = new ReflectionMethod($o, 'method');
$c = Closure::bind($r->getClosure($o), new stdClass());
$c();
Warning: Cannot bind method x::method() to object of class stdClass in /in/PFVqq on line 5
Fatal error: Uncaught Error: Value of type null is not callable in /in/PFVqq:6
Stack trace:
#0 {main}
thrown in /in/PFVqq on line 6
Process exited with code 255.
Warning: Cannot bind method x::method() to object of class stdClass in /in/PFVqq on line 5
Fatal error: Uncaught Error: Function name must be a string in /in/PFVqq:6
Stack trace:
#0 {main}
thrown in /in/PFVqq on line 6
Process exited with code 255.
Fatal error: Class 'Closure' not found in /in/PFVqq on line 5
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/PFVqq on line 2
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/PFVqq on line 2
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/PFVqq on line 2
Process exited with code 255.