Description
The following code:
<?php
class MyClass
{
public static function __callStatic($method, $args)
{
echo $method . "\n";
}
private function privateMethod() {}
protected function protectedMethod() {}
public function publicMethod() {}
}
MyClass::privateMethod();
MyClass::protectedMethod();
MyClass::publicMethod();
Resulted in this output:
privateMethod
protectedMethod
Fatal error: Uncaught Error: Non-static method MyClass::publicMethod() cannot be called statically in ...
But I expected this output instead:
privateMethod
protectedMethod
publicMethod
It seems that the __callStatic magic method is discriminating against public methods. ;)
PHP Version
PHP 8.x
Operating System
Any
Description
The following code:
Resulted in this output:
But I expected this output instead:
It seems that the
__callStaticmagic method is discriminating against public methods. ;)PHP Version
PHP 8.x
Operating System
Any