<?php
class Bar {
public $foo = 1;
}
$Obj1 = new Bar( Foo.bar() ); // Foo нигде не определен! Он должен вызвать фатал
$Obj2 = new stdClass( getFoo( $Obj1 ) ); // getFoo() не существует, почему он работает?
var_dump($Obj1, $Obj2);
Fatal error: Uncaught Error: Undefined constant "Foo" in /in/U5os9:6
Stack trace:
#0 {main}
thrown in /in/U5os9 on line 6
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: Undefined constant "Foo" in /in/U5os9:6
Stack trace:
#0 {main}
thrown in /in/U5os9 on line 6
Process exited with code 255.
Warning: Use of undefined constant Foo - assumed 'Foo' (this will throw an Error in a future version of PHP) in /in/U5os9 on line 6
Fatal error: Uncaught Error: Call to undefined function bar() in /in/U5os9:6
Stack trace:
#0 {main}
thrown in /in/U5os9 on line 6
Process exited with code 255.
Output for 7.1.0 - 7.1.20
Notice: Use of undefined constant Foo - assumed 'Foo' in /in/U5os9 on line 6
Fatal error: Uncaught Error: Call to undefined function bar() in /in/U5os9:6
Stack trace:
#0 {main}
thrown in /in/U5os9 on line 6
Process exited with code 255.