Bug #68475 [Asn]: call_user_func($a) not equivalent to $a()

From: Date: Sat, 29 Nov 2014 12:51:51 +0000
Subject: Bug #68475 [Asn]: call_user_func($a) not equivalent to $a()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188841@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68475&edit=1 ID: 68475 Updated by: jpauli@php.net Reported by: nicolas dot grekas+php at gmail dot com Summary: call_user_func($a) not equivalent to $a() Status: Assigned Type: Bug Package: Scripting Engine problem PHP Version: 5.6.3 Assigned To: jpauli Block user comment: N Private report: N New Comment: Started a work at https://github.com/jpauli/php-src/compare/fix-68475 Previous Comments: ------------------------------------------------------------------------ [2014-11-21 19:48:11] nicolas dot grekas+php at gmail dot com Description: ------------ Since php5.4, call_user_func($a) is almost equivalent to $a() $a() works with all callables BUT ONE. A "foo::bar" string is OK for call_user_func(), but KO for pure syntax. This make the new (and more performant) syntax useless in generic code that want to accept any callable. Test script: --------------- <?php class foo{static function bar(){}} $a = 'foo::bar'; echo is_callable($a),"\n"; call_user_func($a); $a(); Expected result: ---------------- 1 Actual result: -------------- 1 Fatal error: Call to undefined function foo::bar() in ... on line 7 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68475&edit=1

« previous php.bugs (#188841) next »