|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80439 is_callable() does not call autoloader function
Submitted: 2020-11-28 23:15 UTC Modified: 2020-12-06 04:22 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: jozyah-etienne at eerees dot com Assigned: cmb (profile)
Status: No Feedback Package: *General Issues
PHP Version: 8.0.0 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-11-28 23:15 UTC] jozyah-etienne at eerees dot com
It seems that is callable behavior is changed.
In PHP < 8, is_callable() includes needed class file through autoloader and returns .
In PHP 8 it returns false.

$callback = ['\Path\To\ClassName, 'methodName'];
is_callable($callback); // always returns false in PHP 8
$callback(); // but loads needed files through autoloader and executes the callback

Expected result:
It should loads needed files through autoloader and returns a valid value.

Actual result:
Always returns false, no matter if it is really callable or not.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-29 00:03 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-11-29 00:03 UTC]
This is_callable() checks for a *static* class method, but the
method appears to be non-static[1].  As of PHP 8.0.0, static calls
of non-static methods are no longer allowed[2].  Are you sure that
the class is not loaded?

[1] <>
[2] <>
 [2020-12-06 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 22:01:28 2024 UTC