Category
language
Problem
Zend invokes __callStatic(string $name, array $args) when a static method is called on a class but no matching method exists. PurHur/php-compiler fails static calls to undefined methods at runtime today; __callStatic is not dispatched.
Related but distinct from #146 (__get / __set / __call / __toString instance magic) and #3273 sibling #3319 (PR tracker).
Frameworks use __callStatic for static proxy facades (Proxy::__callStatic forwarding to services).
php-src reference
Repro (failure today)
<?php
class Proxy {
public static function __callStatic(string $name, array $args): string {
return $name . ':' . count($args);
}
}
echo Proxy::missing('a', 'b'), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
php repro.php
| Runtime |
Output |
| Zend PHP 8.x |
missing:2 |
bin/vm.php |
fatal / unknown static method |
Maintainer probe (2026-05-30): static Proxy::missing() with __callStatic defined → compile/runtime error in lib/VM.php.
Visibility (done-when)
private __callStatic must not be callable from outside (mirror #145 static visibility rules).
Scope (this repo)
| Layer |
Files |
Notes |
| VM |
lib/VM.php — TYPE_STATIC_CALL |
Slow path: if method missing, lookup __callStatic on class |
| Class metadata |
lib/VM/ClassEntry.php |
Store magic static method id |
| Compiler |
lib/Compiler.php |
Emit generic static dispatch (no compile-time magic name requirement) |
| Args |
pack $args as array for second parameter (Zend subset) |
|
| JIT |
lib/JIT.php |
v1: VM fallback at magic sites (#146 pattern) |
| Tests |
test/compliance/cases/language/magic_call_static.phpt |
|
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter magic_call_static'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
Dependencies
Links
Category
languageProblem
Zend invokes
__callStatic(string $name, array $args)when a static method is called on a class but no matching method exists. PurHur/php-compiler fails static calls to undefined methods at runtime today;__callStaticis not dispatched.Related but distinct from #146 (
__get/__set/__call/__toStringinstance magic) and #3273 sibling #3319 (PR tracker).Frameworks use
__callStaticfor static proxy facades (Proxy::__callStaticforwarding to services).php-src reference
Zend/zend_object_handlers.c—zend_std_get_static_method, magic fallbackZend/zend_API.c—zend_call_known_static_methodwhen method missingZend/zend_compile.c—__callStaticregistered on class entryRepro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php' php repro.phpmissing:2bin/vm.phpMaintainer probe (2026-05-30): static
Proxy::missing()with__callStaticdefined → compile/runtime error inlib/VM.php.Visibility (done-when)
private __callStaticmust not be callable from outside (mirror #145 static visibility rules).Scope (this repo)
lib/VM.php—TYPE_STATIC_CALL__callStaticon classlib/VM/ClassEntry.phplib/Compiler.php$argsas array for second parameter (Zend subset)lib/JIT.phptest/compliance/cases/language/magic_call_static.phptDone when
missing:2on VM__callStaticnot invoked when declared static method exists__callStaticrespects visibility from call site./script/ci-fast.sh --filter magic_call_staticgreenVerification
Dependencies
Links