Re: Validate complex types
| From: | François Gannaz | Date: | Sat, 24 Mar 2012 10:57:38 +0000 |
| Subject: | Re: Validate complex types | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59144@lists.php.net to get a copy of this message | ||
Hi
On 2012-03-23, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> Hi!
>
> > I wanted to use
zend_parse_arg() to validate a single
> > parameter if the
> > first call to zend_parse_parameters_ex() wasn't
> > successful. But this
> > function is never used outside of "Zend/zend_API.c". Is it meant for public
> > use? Are there any drawbacks in calling it?
>
> No, it's currently not meant for public use - it's an internal function
> that is not available to outside modules (thus declared 'static').
> It may make sense to refactor this code and make it more accessible to
> functions that want to parse individual parameter, but currently it is
> not suited for that.
Thanks. As I'm new to php-src, it takes some time to understand this kind of
(undocumented?) conventions. I know it's a tedious task, but I'd really enjoy a
few comments for the Zend API functions.
> I would rather do it differently - I'd allow to run parse on a single
> parameter, i.e. have initial parse with 'z' and then depending on some code
> have something like:
>
> zend_parse_single_arg(my_arg, "l", &l)
>
> So you could do your own checks and then still benefit from the clean API
> provided by parameter parser.
This is something you wrote on github, but I took the liberty to insert it here
as it is related. I thought zend_parse_arg() could be a substitute of your
zend_parse_single_arg(). It cannot be. So, is it worth adding this function
to the API? My own answer is yes, of course, but it does count much.
--
François Gannaz