php.net |  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
Votes:2
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
25 - 20 = ?
Subscribe to this entry?

 
 [2020-11-28 23:15 UTC] jozyah-etienne at eerees dot com
Description:
------------
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-29 00:03 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-11-29 00:03 UTC] cmb@php.net
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] <https://3v4l.org/5p6c3>
[2] <https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.core.other>
 [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 Apr 26 20:01:29 2024 UTC