<?php
class Foo {
private $fn;
public function __construct() { $this->fn = $this->foo; }
public function go() { $this->fn(); }
private function foo() { echo "foo!\n"; }
}
$foo = new Foo();
$foo->go();
Warning: Undefined property: Foo::$foo in /in/LIRIA on line 6
Fatal error: Uncaught Error: Call to undefined method Foo::fn() in /in/LIRIA:7
Stack trace:
#0 /in/LIRIA(12): Foo->go()
#1 {main}
thrown in /in/LIRIA on line 7
Process exited with code 255.
Notice: Undefined property: Foo::$foo in /in/LIRIA on line 6
Fatal error: Uncaught Error: Call to undefined method Foo::fn() in /in/LIRIA:7
Stack trace:
#0 /in/LIRIA(12): Foo->go()
#1 {main}
thrown in /in/LIRIA on line 7
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught Error: Call to undefined method Foo::fn() in /in/LIRIA:7
Stack trace:
#0 /in/LIRIA(12): Foo->go()
#1 {main}
thrown in /in/LIRIA on line 7
Process exited with code 255.
Notice: Undefined property: Foo::$foo in /in/LIRIA on line 6
Fatal error: Call to undefined method Foo::fn() in /in/LIRIA on line 7
Process exited with code 255.
Output for 5.2.6 - 5.2.13, 5.3.0 - 5.3.2
Strict Standards: Redefining already defined constructor for class Foo in /in/LIRIA on line 8
Notice: Undefined property: Foo::$foo in /in/LIRIA on line 6
Fatal error: Call to undefined method Foo::fn() in /in/LIRIA on line 7
Process exited with code 255.
Strict Standards: Redefining already defined constructor for class Foo in /in/LIRIA on line 8
Notice: Undefined property: Foo::$foo in /in/LIRIA on line 6
Fatal error: Call to undefined method Foo::fn() in /in/LIRIA on line 7
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/LIRIA on line 5
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/LIRIA 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/LIRIA on line 5
Process exited with code 255.