<?php
class Example
{
static $function;
static function method()
{
${self::$function}();
}
}
function callback() {}
Example::$function = 'callback';
Example::method();
Warning: Undefined variable $callback in /in/C9MmD on line 9
Fatal error: Uncaught Error: Value of type null is not callable in /in/C9MmD:9
Stack trace:
#0 /in/C9MmD(16): Example::method()
#1 {main}
thrown in /in/C9MmD on line 9
Process exited with code 255.
Notice: Undefined variable: callback in /in/C9MmD on line 9
Fatal error: Uncaught Error: Function name must be a string in /in/C9MmD:9
Stack trace:
#0 /in/C9MmD(16): Example::method()
#1 {main}
thrown in /in/C9MmD on line 9
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
Fatal error: Uncaught Error: Function name must be a string in /in/C9MmD:9
Stack trace:
#0 /in/C9MmD(16): Example::method()
#1 {main}
thrown in /in/C9MmD on line 9
Process exited with code 255.
Notice: Undefined variable: callback in /in/C9MmD on line 9
Fatal error: Function name must be a string in /in/C9MmD on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: callback in /in/C9MmD on line 9
Fatal error: Function name must be a string in /in/C9MmD on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/C9MmD on line 5
Process exited with code 255.
Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/C9MmD on line 5
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/C9MmD on line 5
Process exited with code 255.