Bug #80439 [Opn->Fbk]: is_callable() does not call autoloader function

From: Date: Sun, 29 Nov 2020 00:03:43 +0000
Subject: Bug #80439 [Opn->Fbk]: is_callable() does not call autoloader function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230701@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80439&edit=1

 ID:                 80439
 Updated by:         cmb@php.net
 Reported by:        jozyah-etienne at eerees dot com
 Summary:            is_callable() does not call autoloader function
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *General Issues
 Operating System:   Linux
 PHP Version:        8.0.0
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

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>


Previous Comments:
------------------------------------------------------------------------
[2020-11-28 23:15:01] 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.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80439&edit=1


Thread (3 messages)

« previous php.bugs (#230701) next »