Hi Nikita,

----- Original Message -----
From: "Nikita Popov"
Sent: Tuesday, August 11, 2015

On Tue, Aug 11, 2015 at 10:10 PM, Matt Wilmas <php_li...@realplain.com>
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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to