On Mon, Jul 2, 2018 at 11:45 PM, Christoph M. Becker <cmbecke...@gmx.de> wrote:
> On 02.07.2018 at 23:16, Nikita Popov wrote: > > > On Mon, Jul 2, 2018 at 11:00 PM, Christoph M. Becker <cmbecke...@gmx.de> > > wrote: > > > >> Is there any particular reason why internal functions raise a warning/an > >> error regarding excess arguments, unless they are not supposed to > >> receive any arguments at all? In other words, why don't we use > >> ZEND_PARSE_PARAMETERS_NONE() (except for net_get_interfaces())? > > > > The more common macro for this is zend_parse_parameters_none(), which a > > quick grep shows to be used by 519 functions. If a function accepts no > > arguments and does not use zend_parse_parameters_none(), that's > generally a > > bug. > > Ah, thanks! I couldn't find zend_parse_parameters_none() in > README.PARAMETER_PARSING_API[1] – guess it should be added there. > > Anyhow, I've noticed this due to bug 33502[2], and indeed for > output_reset_rewrite_vars()[3] there is still no ZPP in place. Then > I've checked func_num_args()[4] (which just came to mind), and found > that it doesn't do any ZPP either, as well as other parameterless > functions defined immediately before it. > > Should these (and other occurences, if there are any) be fixed for > PHP-7.1, or for master only? I'm somewhat concerned regarding the > potential BC break, particularly with strict_types. > I'd go for master only as it's technically BC breaking. Some people have plans to get rid of the warning/error on too many arguments to internal functions to make them consistent with user functions, so maybe this will become unnecessary in the future. But given the current state of things, it would certainly be good to add zend_parse_parameters_none() calls where they are missing. Nikita