<?php
class Foo {
private $callable;
public function __construct() {
$this->callable = function () { echo "hello world!"; };
}
public function yesItDoes()
{
$this->callable();
}
}
(new Foo)->yesItDoes();
Fatal error: Uncaught Error: Call to undefined method Foo::callable() in /in/mnjMj:12
Stack trace:
#0 /in/mnjMj(16): Foo->yesItDoes()
#1 {main}
thrown in /in/mnjMj on line 12
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Fatal error: Uncaught Error: Call to undefined method Foo::callable() in /in/mnjMj:12
Stack trace:
#0 /in/mnjMj(16): Foo->yesItDoes()
#1 {main}
thrown in /in/mnjMj on line 12
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Call to undefined method Foo::callable() in /in/mnjMj on line 12
Process exited with code 255.