|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-02-16 19:59 UTC] marcospassos dot com at gmail dot com
Description: ------------ The method_exists function returns false for Closure::__invoke. According to the docs: "Besides the methods listed here, this class also has an __invoke method. This is for consistency with other classes that implement calling magic, as this method is not used for calling the function." Source: http://php.net/manual/en/class.closure.php Test script: --------------- https://3v4l.org/nIte4 Expected result: ---------------- true Actual result: -------------- false PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
I have similar issue with "__invoke()" class MyClass { public function __invoke() {} } __invoke callability tests yield different results than any other public method. is_callable(["MyClass", "__invoke"]) NOT-OK evaluates to FALSE, should be TRUE is_callable(["MyClass::__invoke"]) NOT-OK evaluates to FALSE, should be TRUE is_callable([new MyClass(), "__invoke"] OK php 5.4 yields correct results, 5.5 to 7.3 do not.