Re: Non-pointer params, zend_parse_parameters, and the "!" modifier

From: Date: Sat, 02 Feb 2013 14:06:22 +0000
Subject: Re: Non-pointer params, zend_parse_parameters, and the "!" modifier
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Sat, 02 Feb 2013 14:36:00 +0100, Sara Golemon <[email protected]> wrote:

Gustavo's diff for scalars adds '!' support (this was ignored previously) by letting the NULL get cast to the type (e.g. false/0/0.0) and using a second zend_bool parameter to indicate if NULL was passed or not: long num = 42; zend_bool num_was_null; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l!", &num, &num_was_null) == FAILURE) return; Now if the func is called with NULL as the argument, num will still be overwritten to 0, but we'll get the flag indicating that NULL got passed in, and we're forced to reset it to the default value (assuming that was our intent). [...] Thoughts?
You raise a good point. From my part, feel free to modify it so the passed long is not changed. -- Gustavo Lopes

Thread (3 messages)

« previous php.internals (#65561) next »