|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81626 Error on use static:: in __сallStatic() wrapped to Closure::fromCallable()
Submitted: 2021-11-16 11:36 UTC Modified: 2021-11-16 11:42 UTC
From: sergey dot predvoditelev at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 8.0.12 OS:
Private report: No CVE-ID: None
 [2021-11-16 11:36 UTC] sergey dot predvoditelev at gmail dot com
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']);

Expected result:
No errors.

Actual result:
Error: Cannot access "static" when no class scope is active


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-16 11:42 UTC]
-Status: Open +Status: Verified
 [2021-11-16 11:42 UTC]
Confirming on 7.4/8.0, fixed in 8.1.
 [2021-11-16 11:47 UTC]
Automatic comment on behalf of nikic
Log: Fixed bug #81626
 [2021-11-16 11:47 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 30 05:01:31 2024 UTC