> On 4 Dec 2014, at 19:58, Kalle Sommer Nielsen <ka...@php.net> wrote:
> 
> I think we should solve these on a case-by-case basis, I can think of
> one reason why the warning exists, and that is because it modifies the
> array pointer and the argument is sent by reference. But I think we
> can safely remove the warning if the parameter was not sent by
> reference, as then we would expect the user to use the return value of
> array_pop() to assign the value from. I don't think we should remove
> warnings if you pass a statically value to it, sure some APIs can
> return a variable length/dynamic array but then I think they should be
> referenced into a variable and then passed to the function as they are
> most likely going to be used later, I can't really think of a case
> where it would be useful to send a return value of some API call to
> array_multisort() and then use the boolean true or false to check if
> it was a successful call for example..

Doing it case-by-case seems like the most pragmatic approach.

That being said, I’m not sure there are many cases, if any, for which I don’t 
think a warning should be shown. It feels like an abuse of the internal array 
pointer functions (next/prev/key/extract/etc.) to use them like this. It’d 
probably be better to add non-by-ref functions that do the same thing instead.

--
Andrea Faulds
http://ajf.me/





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

Reply via email to