<?php
class Foo {
public function test() {
echo $undef;
}
public function test2() {
$x = $this; // use $this
echo $undef;
}
}
set_error_handler(function($_1, $_2, $_3, $_4, $ctx) {
var_dump(isset($ctx['this']));
});
(new Foo)->test();
(new Foo)->test2();
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure:/in/sQBL9:13}(), 4 passed in /in/sQBL9 on line 5 and exactly 5 expected in /in/sQBL9:13
Stack trace:
#0 /in/sQBL9(5): {closure:/in/sQBL9:13}(2, 'Undefined varia...', '/in/sQBL9', 5)
#1 /in/sQBL9(16): Foo->test()
#2 {main}
thrown in /in/sQBL9 on line 13
Process exited with code 255.
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 4 passed in /in/sQBL9 on line 5 and exactly 5 expected in /in/sQBL9:13
Stack trace:
#0 /in/sQBL9(5): {closure}(2, 'Undefined varia...', '/in/sQBL9', 5)
#1 /in/sQBL9(16): Foo->test()
#2 {main}
thrown in /in/sQBL9 on line 13
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 4 passed and exactly 5 expected in /in/sQBL9:13
Stack trace:
#0 /in/sQBL9(5): {closure}(2, 'Undefined varia...', '/in/sQBL9', 5)
#1 /in/sQBL9(16): Foo->test()
#2 {main}
thrown in /in/sQBL9 on line 13
Process exited with code 255.