Re: PHP Extension Memory Problems
| From: | Wez Furlong | Date: | Wed, 21 Apr 2004 21:04:19 +0000 |
| Subject: | Re: PHP Extension Memory Problems | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-9470@lists.php.net to get a copy of this message | ||
>
> What can I do in my extension to unset or clear the variable so that it
> doesn’t have to be done in the PHP script?
> if (!PZVAL_IS_REF(Arr))
> {
> zend_error(E_ERROR, "The Arr parameter must be passed by reference");
^^^^^^^
Don't use E_ERROR in an extension unless it would be dangerous for
execution to continue (eg: crash iminent); use E_WARNING instead.
> RETURN_NULL();
> }
SEPARATE_ZVAL(Arr);
> array_init(Arr);
>
> if (add_assoc_string(Arr, (char *) szFieldName, (char *) szValue, 1) ==
> FAILURE) {
> . . .
> }
Hope that helps,
--Wez.