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

From: Date: Tue, 16 Nov 2021 11:47:10 +0000
Subject: Bug #81626 [Ver->Csd]: Error on use static:: in __сallStatic() wrapped to Closure::fromCallable()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237787@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81626&edit=1 ID: 81626 Updated by: git@php.net Reported by: sergey dot predvoditelev at gmail dot com Summary: Error on use static:: in __сallStatic() wrapped to Closure::fromCallable() -Status: Verified +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: 8.0.12 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikic Revision: https://github.com/php/php-src/commit/d26965b2474229efd9b4a997570b3fb924405be9 Log: Fixed bug #81626 Previous Comments: ------------------------------------------------------------------------ [2021-11-16 11:42:03] nikic@php.net Confirming on 7.4/8.0, fixed in 8.1. ------------------------------------------------------------------------ [2021-11-16 11:36:34] sergey dot predvoditelev at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=81626&edit=1

« previous php.bugs (#237787) next »