<?php
class Something {
public function run() {
// instace method called statically.
Crazy::doSomething();
}
public function log($var) {
echo $var;
}
}
class Crazy {
public function doSomething() {
$this->log('Hello World');
}
}
error_reporting(0);
(new Something)->run();
error_reporting(E_ALL | E_STRICT);
(new Something)->run();
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
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Hello World
Deprecated: Non-static method Crazy::doSomething() should not be called statically, assuming $this from incompatible context in /in/Y8sOh on line 8
Hello World
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Hello World
Strict Standards: Non-static method Crazy::doSomething() should not be called statically, assuming $this from incompatible context in /in/Y8sOh on line 8
Hello World