Re: Deprecation of func_get_args(), call_user_func_array() and related API
| From: | Leigh | Date: | Fri, 10 Oct 2014 23:24:32 +0000 |
| Subject: | Re: Deprecation of func_get_args(), call_user_func_array() and related API | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77866@lists.php.net to get a copy of this message | ||
On 10 October 2014 21:27, Marco Pivetta <ocramius@gmail.com> wrote:
> Hello folks,
>
> While rambling with some code today, I realized that
>
call_user_func
> behaves strangely, appearing and disappearing from stack traces depending
> on versions of PHP. For an example, compare
> http://3v4l.org/fGpIk#vphp7@20140901,
> http://3v4l.org/fGpIk#v530 and
> http://3v4l.org/fGpIk#vhhvm-301.
>
Ok. Knee jerk reaction is +1 for consistency, we should decide on what
is the expected and accepted behaviour and make sure tests are written
so that we don't deviate from that.
> Therefore, here comes my idea of simply getting rid of
> call_user_func,
> call_user_func_array,
> func_get_args, func_num_args and
> func_get_arg.
>
> My plan for it would be to add a deprecation (notice? not sure about that)
> in PHP 5.7, and a complete removal of those methods in PHP 7.0.
>
I understand your impulse, but I agree with others, these are far too
widely used to be deprecated like this
> BC compatibility is easily achieved as variadics (
> https://wiki.php.net/rfc/variadics) allow for writing cleaner
> and less
> complex versions:
>
True.
So can we make these functions behave as if variadics were used
without removing them? Something akin to making these functions
language constructs?