Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59144 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4007 invoked from network); 24 Mar 2012 10:57:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Mar 2012 10:57:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois.gannaz@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=francois.gannaz@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.170 as permitted sender) X-PHP-List-Original-Sender: francois.gannaz@gmail.com X-Host-Fingerprint: 74.125.82.170 mail-we0-f170.google.com Received: from [74.125.82.170] ([74.125.82.170:42595] helo=mail-we0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 39/DD-18105-8A8AD6F4 for ; Sat, 24 Mar 2012 05:57:45 -0500 Received: by werh12 with SMTP id h12so3737964wer.29 for ; Sat, 24 Mar 2012 03:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; bh=REuha3G4XP2RvIxsAKGn+OJPXv52vmDWrJAYF8wMba8=; b=CFx8fKD+DroFJR8ujwdYpXSuc9ZFJgZ8fz0gyVhRFCB6PcrJKDPwqmV4FnAFVf8EUz qlNHqTvZxE4JFsSrZ8LPp6BetB79rm8ag164eIgYyQoKFgSiF0vLXt+1K0w1eVQH2mGV NwR/DAqVjBVE8MlY5lS/HcIbIS6nBqlpcaPTkYfZqKxafwiEOsGI0Mfp7GlLoXQSZlFA +d2s2/CbKcaebRgiQi1RsqSOkPsg0asZ/HK4gAI+p32xaEiIu7zBP19LRKJaYZztYTQb YOBoqzfcgat+NsLnkMRoVU32TyVfbC4ct3Jkm0KhgOxiEma1Krl8ZvxlyjWwoBauVtMI 99ag== Received: by 10.180.24.7 with SMTP id q7mr4219167wif.11.1332586662260; Sat, 24 Mar 2012 03:57:42 -0700 (PDT) Received: from coriolan (lear.silecs.info. [88.172.133.112]) by mx.google.com with ESMTPS id ex2sm36039066wib.8.2012.03.24.03.57.39 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Mar 2012 03:57:40 -0700 (PDT) Date: Sat, 24 Mar 2012 11:57:38 +0100 To: internals@lists.php.net Message-ID: <20120324115738.04fa708b@coriolan> In-Reply-To: <4F6CB50D.2060804@sugarcrm.com> References: <20120323172608.3672eec8@coriolan> <4F6CB50D.2060804@sugarcrm.com> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Validate complex types From: francois.gannaz@gmail.com (=?ISO-8859-1?B?RnJhbudvaXM=?= Gannaz) Hi On 2012-03-23, Stas Malyshev wrote: > Hi! >=20 > > 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 pu= blic > > use? Are there any drawbacks in calling it? >=20 > 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 enj= oy 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 co= de > have something like: >=20 > zend_parse_single_arg(my_arg, "l", &l)=20 >=20 > 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 functi= on to the API? My own answer is yes, of course, but it does count much. -- Fran=E7ois Gannaz