I've got some code that wraps objects from an external library.
The "glue code" sets a flag when a reference parameter is set by
a function; the code in my (ZE1) call handler looks something like this:

if (args[i].isref) {
   if (!PZVAL_IS_REF(arguments[i])) {
        php_error(E_WARNING, "%s(): parameter %d was not passed by reference!",
             Z_STRVAL(function_name->element), i);
   }
   SEPARATE_ZVAL_IF_NOT_REF(&arguments[i]);
   fill_zval_from_arg(arguments[i], &args[i] TSRMLS_CC);
   arguments[i]->is_ref = 1;
   arguments[i]->refcount = 2;
}

arguments is a zval ** populated using zend_get_parameters_array().
args a zval-alike used to talk to the library.

Now, if I call my overloaded object like this:

  $obj->foo(&set_me_please);

$set_me_please correctly picks up the value set by the foo function.

If I call it like this:

  $obj->foo($set_me_please);

Then I get a warning about the parameter not being passed by reference
and $set_me_please ends up (or remains) NULL.

Is there any way for the latter case to set $set_me_please, without
explicitly using the &?

--Wez.

-- 
Wez Furlong
The Brain Room Ltd.


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

Reply via email to