Bug #70088 [NEW]: is_callable() doesn't check if a class/method syntax is valid

From: Date: Thu, 16 Jul 2015 12:53:42 +0000
Subject: Bug #70088 [NEW]: is_callable() doesn't check if a class/method syntax is valid
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194489@lists.php.net to get a copy of this message
From: olivier dot laviale at gmail dot com Operating system: MacOS, Linux PHP version: 5.6.11 Package: Scripting Engine problem Bug Type: Bug Bug description:is_callable() doesn't check if a class/method syntax is valid Description: ------------ is_callable(), with _syntax_only_ activated, only checks the type of the argument, not the actual syntax. For example "+{^not&a*callable}" is considered a callable just because it is a string. I saw this bug report: https://bugs.php.net/bug.php?id=64185&edit=2, and I get it for class names, but what about function/method names? "+{^not&a*callable}" is definitely not a callable, or the parameter "syntax_only" is incredibly misleading. Test script: --------------- var_dump(is_callable('+{^not&a*callable}', true, $callable_name)); var_dump($callable_name); var_dump(is_callable(123, true)); var_dump(is_callable("123", true)); var_dump(is_callable([ "1", "2" ], true)); Expected result: ---------------- "+{^not&a*callable}" shouldn't be considred as a callable, neither should [ "1", "2" ]. bool(false) null bool(false) bool(false) bool(false) Actual result: -------------- bool(true) string(18) "+{^not&a*callable}" bool(false) bool(true) bool(true) -- Edit bug report at https://bugs.php.net/bug.php?id=70088&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70088&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70088&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70088&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70088&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70088&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70088&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70088&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70088&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70088&r=support Expected behavior: https://bugs.php.net/fix.php?id=70088&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70088&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70088&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70088&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70088&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70088&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70088&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70088&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70088&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70088&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70088&r=mysqlcfg

« previous php.bugs (#194489) next »