Hi internals! With regard to my E_STRICT RFC [1] Yasuo and another off-the-record mail expressed a concern about the "Only variables should be passed by reference" strict standards warning.
This notices makes sense in a lot of places, e.g. array_push(getArray(), 1, 2, 3); is totally pointless code if getArray() doesn't return a reference. array_push will just modify a temporary array in this case. However other usages like $top = array_pop(getArray()); are less clear: array_pop() both has a side-effect (removing the top element of an array) and a meaningful return value (the top element of the array). As PHP does not have a dedicated function for getting the first/last element of an array, many people use code like this (which currently throws E_STRICT) instead. I'd like to mark a few such functions with PREFER_REF (i.e. allow passing both references and values). In particular array_pop() and array_shift(). Does anybody have a problem with us doing this? Are there other functions which should use PREFER_REF? The motivation behind this is to make sure we only throw this notice in cases where the code is actually buggy/nonsensical instead of just making people ignore it altogether. Thanks, Nikita [1]: https://wiki.php.net/rfc/reclassify_e_strict