Re: Reverting "Too Few Arguments Exception" RFC

From: Date: Fri, 26 Aug 2016 17:57:11 +0000
Subject: Re: Reverting "Too Few Arguments Exception" RFC
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-95456@lists.php.net to get a copy of this message
On 26.08.2016 at 16:48, Levi Morrison wrote: > On Fri, Aug 26, 2016 at 4:53 AM, Christoph M. Becker <cmbecker69@gmx.de> wrote: > >> 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. > > 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. Indeed, I've overlooked that array_diff() accepts a single array. So, ZPP could use "aa*". My point is that it's better to rely on common checks (and respective errors), than to have individual checks for each (group of) function(s). If that had already been the case, we wouldn't need to have this discussion. :-) -- Christoph M. Becker

« previous php.internals (#95456) next »