<?php
class A {
function __construct() {
echo 'direct owner: '.__CLASS__."\n";
echo 'called as part of: '.self::class."\n";
echo 'called by instance of: '.static::class."\n";
}
}
class B extends A { }
class C {
function __construct() {
B::A();
}
}
new C();
Fatal error: Uncaught Error: Call to undefined method B::A() in /in/0IDQI:15
Stack trace:
#0 /in/0IDQI(18): C->__construct()
#1 {main}
thrown in /in/0IDQI on line 15
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 B::A() in /in/0IDQI:15
Stack trace:
#0 /in/0IDQI(18): C->__construct()
#1 {main}
thrown in /in/0IDQI on line 15
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined method B::A() in /in/0IDQI on line 15
Process exited with code 255.