Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87735 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91876 invoked from network); 12 Aug 2015 22:10:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Aug 2015 22:10:49 -0000 Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 216.33.127.82 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 216.33.127.82 mta31.charter.net Solaris 10 1203 Received: from [216.33.127.82] ([216.33.127.82:45793] helo=mta31.charter.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/82-03000-764CBC55 for ; Wed, 12 Aug 2015 18:10:48 -0400 Received: from imp09 ([10.20.200.9]) by mta31.charter.net (InterMail vM.8.01.05.02 201-2260-151-103-20110920) with ESMTP id <20150812221044.NFPX10321.mta31.charter.net@imp09>; Wed, 12 Aug 2015 18:10:44 -0400 Received: from mtaout005.msg.strl.va.charter.net ([68.114.190.30]) by imp09 with smtp.charter.net id 3yAk1r0080fnx6C05yAklf; Wed, 12 Aug 2015 18:10:44 -0400 Received: from impout003 ([68.114.189.18]) by mtaout005.msg.strl.va.charter.net (InterMail vM.9.00.020.01 201-2473-160) with ESMTP id <20150812221044.LTJO28769.mtaout005.msg.strl.va.charter.net@impout003>; Wed, 12 Aug 2015 17:10:44 -0500 Received: from pc1 ([96.35.251.86]) by impout003 with charter.net id 3yAk1r00D1sc0so01yAkLE; Wed, 12 Aug 2015 17:10:44 -0500 X-Authority-Analysis: v=2.1 cv=Pvkdbm83 c=1 sm=1 tr=0 a=Is5gsZaFXO8aPum+t7Tz+g==:117 a=Is5gsZaFXO8aPum+t7Tz+g==:17 a=hOpmn2quAAAA:8 a=BCPeO_TGAAAA:8 a=N659UExz7-8A:10 a=5-tF3oUMKVc4yjaRGhMA:9 a=pILNOxqGKmIA:10 Message-ID: <8C6F1FDE1BF041CCABC404954AB3B40F@pc1> To: "PHP Internals" , "Nikita Popov" Cc: "Dmitry Stogov" References: <8BE12FDCDC5C457282790368866BD61E@pc1><04E6618E3189404FB15D042E588A90FC@pc1> Date: Wed, 12 Aug 2015 17:10:44 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="Windows-1252"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Subject: Re: [PHP-DEV] Parameter parsing for zval type? From: php_lists@realplain.com ("Matt Wilmas") Hi Nikita, ----- Original Message ----- From: "Nikita Popov" Sent: Tuesday, August 11, 2015 > On Tue, Aug 11, 2015 at 10:10 PM, Matt Wilmas > wrote: > >> [...] >> >> Look at e.g. is_numeric() or strpos() (needle). Plain zval param >> parsing, >> so NO ZVAL_DEREF() occurs (FAST_ZPP or traditional). These 2 example >> functions don't handle IS_REFERENCE type, so they would break. >> >> Or is there no way for them (or any function?) to get a IS_REFERENCE? >> Then *why* is there ZVAL_DEREF() in param parsing functions? We could >> remove it! >> >> Which is it...? >> > > Functions accepting references are specially marked in arginfo. Normal > function argument can never be IS_REFERENCE. Reference arguments are > always > IS_REFERENCE. There is also a rarely used mixed mode where both are > possible. For DEREF-or-not distinction is irrelevant for normal arguments, > it's only important if an argument is already marked to accept a ref. Thanks. Yeah, OK, I see ZEND_SEND_REF creates a reference (if not already), which allows the ref'd var to be "recovered" later with ZVAL_DEREF() while parsing. I guess that's right! I *think* any by-reference argument also needs to be separated during parsing (to not affect anything else). Is that correct logic? If so, we can say that DEREF is only needed if also separating (which only applies to array/string/plain zval types, AFAIK). But what is the "rarely used mixed mode where both are possible?" > Nikita Thanks, Matt