Req #64185 [Com]: is_callable does not check syntax
| From: | hanskrentel at yahoo dot de | Date: | Sun, 10 Feb 2013 17:04:38 +0000 |
| Subject: | Req #64185 [Com]: is_callable does not check syntax | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176552@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64185&edit=1
ID: 64185
Comment by: hanskrentel at yahoo dot de
Reported by: hanskrentel at yahoo dot de
Summary: is_callable does not check syntax
Status: Open
Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: 5.4.11
Block user comment: N
Private report: N
New Comment:
NikiC was so friendly to just remind me that checking for the method name *is* limited because of
__call and __callStatic (basically everything for a method name works, including a zero-length
string).
So this feature request is actually more about the classname validation then the method name
validation.
Previous Comments:
------------------------------------------------------------------------
[2013-02-10 16:04:21] hanskrentel at yahoo dot de
Description:
------------
Using is_callable with the syntax_only parameter set to true does actually *not*
check the syntax, for example of a valid classname or FQCN.
Also not for the method name.
My feature request is, that it will always check those strings according to the
rules set in the PHP parser of the same PHP version the function ships with so
that it can be used to validate PHP syntax as well.
Same for calls with :: for static class name method calls.
Test script:
---------------
var_dump(is_callable(['', ''], true));
var_dump(is_callable(['', 'method'], true));
var_dump(is_callable(['0', 'method'], true));
var_dump(is_callable(['0\\foo', 'method'], true));
var_dump(is_callable(['\\0\\foo', 'method'], true));
Expected result:
----------------
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
Actual result:
--------------
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64185&edit=1