Re: zend_parse_parameters() improvements

From: Date: Thu, 19 Jul 2012 22:20:49 +0000
Subject: Re: zend_parse_parameters() improvements
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Okay, well... the main pieces of feedback I'd give on it then is to not
change the behavior of the '!' modifier.  That's bad BC.  Rather, introduce
a new modifier for checking if a parameter was passed.  Secondly, make
these two separate patches as the new modifier is a separate feature from
the single-arg parameter parsing.

FWIW, there are a few examples of this being handled by defining the
default value of the parameter to something non-sensical (such as a length
of -1), then doing zpp with "|l!" would leave the default -1 alone when
NULL is passed, and you can treat as "not passed".  Granted this is a bit
of a hack and won't work for all situations.  Your approach is more
comprehensive, just saying that for many cases it's not strictly needed.

-Sara

On Thu, Jul 19, 2012 at 2:33 PM, Nikita Popov <[email protected]> wrote:

> On Thu, Jul 19, 2012 at 11:23 PM, Sara Golemon <[email protected]> wrote:
> > Then I'm not sure what problem you're trying to solve either. :/
>
> This solves two problems:
>
> a) Integer parameters cannot currently be skipped using NULL. This
> issue comes up every now and then. E.g. see
> https://github.com/php/php-src/pull/133.
>
> b) If you need more complex argument handling you currently have to
> fetch the value as z and then use some convert_to_* function. But
> those convert_to_* functions behave differently than zpp. So a
> function for parsing a single parameter is exposed too.
>
> Nikita
>


Thread (26 messages)

« previous php.internals (#61526) next »