Category
Language · php-src-strict · magic static call visibility (regression vs #3273)
Problem
Same visibility rule as instance __call, for statics: an inaccessible private static method from outside scope must dispatch __callStatic. VM throws private-method Error instead.
| Repro (2026-07-31) |
Zend 8.2 |
VM |
A::hid() with private static function hid() + __callStatic |
CS_hid / m |
Error: Call to private method A::hid() from global scope |
php-src reference
PHP implementation target
lib/VM.php — static method resolution / __callStatic walk (~18282+): visibility failure for caller scope → __callStatic, not private Error
- PHP-in-PHP only
- Compliance:
test/compliance/cases/language/magic_callstatic_private.phpt
Repro
./script/docker-exec.sh -- bash -lc 'cat > /tmp/cs_priv.php <<'"'"'PHP'"'"'
<?php
class A {
private static function hid() { return "p"; }
public static function __callStatic($n, $a) { echo "CS_$n\n"; return "m"; }
}
echo A::hid(), "\n";
PHP
php bin/vm.php /tmp/cs_priv.php'
Done when
Category
Language· php-src-strict · magic static call visibility (regression vs #3273)Problem
Same visibility rule as instance
__call, for statics: an inaccessibleprivate staticmethod from outside scope must dispatch__callStatic. VM throws private-methodErrorinstead.A::hid()withprivate static function hid()+__callStaticCS_hid/mError: Call to private method A::hid() from global scopephp-src reference
Zend/zend_object_handlers.c—zend_std_get_static_methodslow path →__callStaticPHP implementation target
lib/VM.php— static method resolution /__callStaticwalk (~18282+): visibility failure for caller scope →__callStatic, not privateErrortest/compliance/cases/language/magic_callstatic_private.phptRepro
Done when
__callStatic