Bug #81626 [NEW]: Error on use static:: in __сallStatic() wrapped to Closure::fromCallable()

From: Date: Tue, 16 Nov 2021 11:36:46 +0000
Subject: Bug #81626 [NEW]: Error on use static:: in __сallStatic() wrapped to Closure::fromCallable()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237785@lists.php.net to get a copy of this message
From: sergey dot predvoditelev at gmail dot com Operating system: PHP version: 8.0.12 Package: Scripting Engine problem Bug Type: Bug Bug description:Error on use static:: in __сallStatic() wrapped to Closure::fromCallable() Description: ------------ Throws error on use static:: in __сallStatic() wrapped to Closure::fromCallable(). Note, if use static:: in static method wrapped to Closure::fromCallable(), then no errors. Test script: --------------- class TestClass { public static bool $wasCalled = false; public static function __callStatic(string $name, array $args): string { static::$wasCalled = true; return 'ok'; } } $closure = Closure::fromCallable([TestClass::class, 'foo']); $closure(); Expected result: ---------------- No errors. Actual result: -------------- Error: Cannot access "static" when no class scope is active -- Edit bug report at https://bugs.php.net/bug.php?id=81626&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81626&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81626&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81626&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81626&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81626&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81626&r=support Expected behavior: https://bugs.php.net/fix.php?id=81626&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81626&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81626&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81626&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81626&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81626&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81626&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81626&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81626&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81626&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81626&r=mysqlcfg

« previous php.bugs (#237785) next »