Edit report at https://bugs.php.net/bug.php?id=68475&edit=1
ID: 68475
Updated by: aharvey@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
+Type: Feature/Change Request
Package: Scripting Engine problem
PHP Version: 5.6.3
Assigned To: jpauli
Block user comment: N
Private report: N
New Comment:
I might prefer unifying the VM code with the code call_user_func() and friends use: something like
https://github.com/LawnGnome/php-src/compare/call-static-methods?expand=1
(albeit I think we'd want to refactor the critical code path out of
zend_is_callable_check_func() into a separate function to minimise the overhead). Having two sources
of truth for what a string callable can look like is what got us in this mess. :)
Whatever the approach, let's do this in PHP 7. Julien, do you want to write the RFC, or shall
I?
Previous Comments:
------------------------------------------------------------------------
[2014-12-16 13:19:24] jpauli@php.net
I agree that for consistency, this should be supported
------------------------------------------------------------------------
[2014-12-14 15:19:23] nicolas dot grekas+php at gmail dot com
You can't say "just use the standard ['Class', 'method'] callback
style"; there are of code out there that use the 'Class::method' style, you
can't ignore it. This is where the blocker is: BC
------------------------------------------------------------------------
[2014-12-04 19:37:15] nikic@php.net
I don't get why this is a blocker for anything. Why not just use the standard
['Class', 'method'] callback style?
Imho the 'Class::method' style is just unnecessary duplication and should be removed in
the future, rather than implemented in more places.
------------------------------------------------------------------------
[2014-12-04 11:03:44] stof at notk dot org
> This behavior was never supported in PHP5, so it's not a bug but a feature request. I
> think, such change may be accepted in PHP7 (no way for php-5.6).
Well, "foo::bar" callables are supported by PHP in all places except the $a() syntax:
- is_callable is returning true for them
- the callable typehint accepts them
- call_user_func and call_user_func_array accept them.
So this means that callables in PHP still cannot be called directly. PHP 5.4 only expanded the
support for direct call, but it is still incomplete.
So this makes it a blocker for deprecating the call_user_func functions altogether, as they are
still the only reliable way to call a generic callable.
------------------------------------------------------------------------
[2014-12-01 11:18:27] dmitry@php.net
This behavior was never supported in PHP5, so it's not a bug but a feature request. I think,
such change may be accepted in PHP7 (no way for php-5.6).
The real "fast" path (when OP2_TYPE == IS_CONST) must not be affected.
The implementation is not a problem (I can take care about it), but such change should be approved.
I'm not sure if this needs RFC or not (probably better to follow the standard RFC procedure).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=68475
--
Edit this bug report at https://bugs.php.net/bug.php?id=68475&edit=1