OK thanks for the additional info. Will take a look.
At 05:05 PM 8/23/2005, Sara Golemon wrote:
> We'll take a look at it as this should actually work today.
>
That's what I'd thought coming into this, but all my attempts to return a
reference failed:
My Arg Info struct:
static
ZEND_BEGIN_ARG_INFO_EX(php_sample_retref_arginfo, 0, 1, 0)
ZEND_END_ARG_INFO()
My reference linking:
if (return_value_ptr) {
zval_ptr_dtor(return_value_ptr);
}
SEPARATE_ZVAL_TO_MAKE_IS_REF(&val);
ZVAL_ADDREF(val);
*return_value_ptr = val;
There's some commented out code in there that refers to bug 34045:
/* We shouldn't fix bad extensions here,
because it can break proper ones (Bug #34045)
if (!EX(function_state).function->common.return_reference) {
EX_T(opline->result.u.var).var.ptr->is_ref = 0;
EX_T(opline->result.u.var).var.ptr->refcount = 1;
}
*/
With that code in there returning references would certainly never work so
I'd be curious about the events leading up to that removal as much as
anything.
> As to back porting, I don't think we should touch the stable branches.
>
Eh, it's a 50/50 on this one since the bug only effects internals code and
(last I checked) there's nothing internal that's trying to return a
reference other that OOP code (because it gets shoved into being a reference
anyway). I only came across this because I was trying to come up with some
example code "If you wanted to do this you could...".
I know I personally would like to see it work in 5.1 at the least (being shy
of final such as we are...). As for 5.0... yeah let's sleeping dogs lie.
-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php