<?php
class Foo
{
public $lemon = 1;
public function test($test, $cb)
{
return function () { return $this->lemon; };
}
}
$x = (new Foo())->test();
echo $x();
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Foo::test(), 0 passed in /in/kOCPQ on line 18 and exactly 2 expected in /in/kOCPQ:12
Stack trace:
#0 /in/kOCPQ(18): Foo->test()
#1 {main}
thrown in /in/kOCPQ on line 12
Process exited with code 255.
Warning: Missing argument 1 for Foo::test(), called in /in/kOCPQ on line 18 and defined in /in/kOCPQ on line 12
Warning: Missing argument 2 for Foo::test(), called in /in/kOCPQ on line 18 and defined in /in/kOCPQ on line 12
1
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/kOCPQ on line 18
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/kOCPQ on line 14
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/kOCPQ on line 14
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/kOCPQ on line 9
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/kOCPQ on line 9
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/kOCPQ on line 9
Process exited with code 255.