On Fri, Aug 26, 2016 at 4:53 AM, Christoph M. Becker <cmbecke...@gmx.de> wrote:
> On 25.08.2016 at 18:37, Davey Shafik wrote:
>
>> On Thu, Aug 25, 2016 at 8:12 PM, Christoph M. Becker <cmbecke...@gmx.de>
>> wrote:
>>
>>> Indeed, the RFC explicitly claims:
>>>
>>> | Behavior of internal functions is not going to be changed.
>>
>> This is correct for functions that had the correct behavior before
>> (everything but array functions).
>>
>> I can remove that part of the change — but if we're going to change it,
>> doing in 7.1 rather than > 7.1 would be best.
>
> AIUI, the actual implementation of the too_few_args RFC does what it
> says, namely to not affect the behavior of internal function at all.
> The issue you've raised is that we have introduced an inconsistency,
> because some internal functions (e.g. array_diff) behave differently.
>
> If that is so, reverting the too_few_args RFC is out of question,
> because not changing the behavior of internal functions was intentional,
> and I assume that everybody who voted on the RFC was aware of that.
>
> The inconsistency between internal functions wrt. to too few/many
> arguments in strict_types mode is not related to the too_few_args RFC at
> all – we have this as of PHP 7.  Fixing this inconsistency as soon as
> possible might be desirable, but it seems to me that is not even
> possible in the general case, as not all relevant code is under our
> control (think of PECL and even "private" extensions).
>
> So, even we "fix" the behavior of all bundled internal functions, we
> still can't claim that *all* functions throw an exception when called
> with too few or too many arguments in strict_types mode (besides that we
> easily might miss a few cases).  If the docs already make this claim,
> the docs should be fixed.
>
> Finally, I wonder why array_diff(), for instance, even has an explicit
> check for ZEND_NUM_ARGS() and for Z_TYPE() != IS_ARRAY instead of
> properly invoking zend_parse_parameters() with "aa+" instead of "+" in
> the first place?  Maybe I'm missing something, but otherwise I would
> suggest to fix that altogether instead of piecemeal, even if that has to
> wait until 8.0.
>
> --
> Christoph M. Becker
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php

Well, its behavior does differ with a single array: it will preserve
keys in this case. If more than one array is passed it will
numerically index the keys starting at zero. This is the only reason I
can think of.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to