Re: [PHP4BETA] array_walk() problem
| From: | Andrey Zmievski | Date: | Thu, 22 Jul 1999 14:30:42 +0000 |
| Subject: | Re: [PHP4BETA] array_walk() problem | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-2527@lists.php.net to get a copy of this message | ||
Andrey Zmievski wrote:
> The fix is trivial, but the result is that it's no longer possible to
modify
> array values inside the walk function. Is there any way around it? Zeev?
-- End of excerpt from Andrey Zmievski
Taking a closer look at call_user_function() reveals:
for (i=0; i<param_count; i++) {
zval *param;
param = (zval *) emalloc(sizeof(zval));
*param = *(params[i]);
INIT_PZVAL(param);
zval_copy_ctor(param);
zend_ptr_stack_push(&EG(argument_stack), param);
}
Which means that the user function is always passed a copy of the parameters,
so it's impossible to modify them. But I think this functionality is needed.
Would it break anything if just incremented refcount on the params[] and
pushed them on the argument stack?
-Andrey
* Software never has bugs. It just develops random features. *