Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59141 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69617 invoked from network); 23 Mar 2012 16:26:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Mar 2012 16:26:11 -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 209.85.212.182 as permitted sender) X-PHP-List-Original-Sender: francois.gannaz@gmail.com X-Host-Fingerprint: 209.85.212.182 mail-wi0-f182.google.com Received: from [209.85.212.182] ([209.85.212.182:46478] helo=mail-wi0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/55-41302-124AC6F4 for ; Fri, 23 Mar 2012 11:26:10 -0500 Received: by wibhr14 with SMTP id hr14so2097871wib.11 for ; Fri, 23 Mar 2012 09:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=jMUc6nVtJsffe8anWCrRBixTEUNQ1/1Zkz3ffSJ7QgY=; b=QOR9/AREobGnJchGEM/bcwYfgbztRZIq2qTH0nE31C1G4+UojRu36UnTEOnN/CXdo5 lXI9EALJ3DdkywGHyUJayvapHnjLifxY11mB4dF+2haloJo6vmUICxi1zCtIINmf9BvS UObFgAlK6Y/DikGwyVBZwpoIwJrNnX8+xEzrUslxWhNa5QgssMh1+QcuCPVfhL8dXqNm qFML2ERZj31fDHtrpI4Q9VLLhDj+dDLkoHjULJzPUKPkqrZ+BVEaIUt5LC2t4KnPGO9A y9qbqLbEjHOFUt63ZeE9qNNPqZZXjvUKvIaF7bJaEF0BV5LCPsnozsfQ6z/6twHRBvGn DdeA== Received: by 10.180.84.164 with SMTP id a4mr8013618wiz.2.1332519966845; Fri, 23 Mar 2012 09:26:06 -0700 (PDT) Received: from coriolan (lear.silecs.info. [88.172.133.112]) by mx.google.com with ESMTPS id e6sm14968678wix.8.2012.03.23.09.26.04 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Mar 2012 09:26:05 -0700 (PDT) Date: Fri, 23 Mar 2012 17:26:08 +0100 To: internals@lists.php.net Message-ID: <20120323172608.3672eec8@coriolan> 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: Validate complex types From: francois.gannaz@gmail.com (=?ISO-8859-1?B?RnJhbudvaXM=?= Gannaz) Hello I'm wondering if there is a recommended way to validate a multi-type parame= ter in an internal function. If a parameter is expected to be "long or string" = or to be "integer or null", a simple call to `zend_parse_parameters()` won't validate it. I read some extensions' code, and it seems that the preferred method is to = call `zend_parse_parameters(_ex)` several times until one validation succeeds or= all fail. I really don't like this solution. Maybe the performance penalty of parsing twice the arguments is negligible, but I don't even like the idea of this code. Isn't there a better solution? Or did I miss a good reason for t= his? 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 func= tion is never used outside of "Zend/zend_API.c". Is it meant for public use? Are there any drawbacks in calling it? Regards -- Fran=E7ois Gannaz