Edit report at https://bugs.php.net/bug.php?id=68475&edit=1
ID: 68475
Updated by: laruence@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:
for the record, they are never guaranteed to be act the same.
and, there is voice to deprecated call_user_** at all.
so I don't think the fix is worthy to do (slowdown the fast path) ..
thanks
Previous Comments:
------------------------------------------------------------------------
[2014-12-01 03:39:16] laruence@php.net
for the record, they are never guaranteed to be act the same.
and, there is voice to deprecated call_user_** at all.
so I don't think the fix is worthy to do (slowdown the fast path) ..
thanks
------------------------------------------------------------------------
[2014-11-29 12:51:50] jpauli@php.net
Started a work at https://github.com/jpauli/php-src/compare/fix-68475
------------------------------------------------------------------------
[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