Doc #80110 [NEW]: object with __invoke method is considered callable
| From: | divinity76+spam at gmail dot com | Date: | Wed, 16 Sep 2020 06:58:18 +0000 |
| Subject: | Doc #80110 [NEW]: object with __invoke method is considered callable | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-17892@lists.php.net to get a copy of this message | ||
From: divinity76+spam at gmail dot com
Operating system:
PHP version: 8.0.0beta3
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:object with __invoke method is considered callable
Description:
------------
the Callable documentation at
https://www.php.net/manual/en/language.types.callable.php
says these things can be callable: a string containing a function name
or "ClassName::StaticMethod", and an array containing containing an
object or classname in index 0 and a string in index 1, and finally,
closures.
but every PHP version since 5.3.0 (when __invoke was introduced)
consider an object with an __invoke method to be callable as well,
either the documentation is lacking and objects with __invoke are indeed
callable, or the php implementation is wrong, i'm guessing it's the
former
Test script:
---------------
<?php
class C{
function __invoke(){}
}
var_dump(is_callable(new C));
Expected result:
----------------
// according to Callable type documentation
bool(false)
Actual result:
--------------
bool(true)
--
Edit bug report at https://bugs.php.net/bug.php?id=80110&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80110&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80110&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80110&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80110&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80110&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80110&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80110&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80110&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80110&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80110&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80110&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80110&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80110&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80110&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80110&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80110&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80110&r=mysqlcfg