Req #68475 [Com]: call_user_func($a) not equivalent to $a()
| From: | me at evertpot dot com | Date: | Thu, 07 May 2015 08:44:03 +0000 |
| Subject: | Req #68475 [Com]: call_user_func($a) not equivalent to $a() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192547@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
Comment by: me at evertpot dot com
Reported by: nicolas dot grekas+php at gmail dot com
Summary: call_user_func($a) not equivalent to $a()
Status: Assigned
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:
Personally I think the major issue here is not so much that if call_user_func($a) is not equivalent
to $a(), but rather that both is_callable and the callable typehint accepts a value that can't
be invoked with $x().
Previous Comments:
------------------------------------------------------------------------
[2015-01-09 11:47:04] jpauli@php.net
I don't think we need to RFC that.
What we want, is uniformisation and consistency in the way we can call a PHP function from a PHP
string.
No new idea, no debatte, no RFC needed.
------------------------------------------------------------------------
[2015-01-08 20:16:32] aharvey@php.net
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?
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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