Hi niel,
Am 18.06.2018 um 01:59 schrieb niel:
However my main concern that a non-array variable or a non-existent
value, are an error and need to be handled appropriately, has not
changed. IMO, a notice/warning does little to nothing in helping the
programmer determine the problem and track down the cause. Which
leaves one having to wrap these functions in 'if (is_array($var) &&
!empty($var)) {...}' to prevent the possibility.
The current implementation is eqivalent to the other array_* functions
as shown in the previous mail and can be checked in
https://github.com/php/php-src/pull/3256/commits/ec2332be93272d202a2a5cef841c266f77f64b08#diff-e00a584724b997f38e851e15f1e20c39
I can comprehend your doubts about the return value but currently I
can't imagine a solution which would suite the case better than null
especially if we think about extending the scope to
array_value_(first|last).
Do you/anyone have an idea how we can provide better information towards
the programmer to determine the issue?
Enno
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php