Input paramters...
| From: | David Muse | Date: | Wed, 22 Nov 2000 20:32:10 +0000 |
| Subject: | Input paramters... | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38943@lists.php.net to get a copy of this message | ||
I've got a question about input parameters:
After calling zend_get_parameters, are the zval's that it returns appear to be
deallocated automatically when the function terminates. Is this proper
behavior?
The issue is as follows:
Say I have a PHP function that accepts a string, calls zend_get_parameters
and passes the value.str.val member to a C function that accepts a char*.
If that C function passes the char* to a C++ function that sets a private
member variable (also of type char*) equal to it, future references to that
private member variable return the wrong value. In fact, they frequently
return PHP function names.
I assume that what's happening is that the zval is getting deallocated and
another variable is getting allocated and used at the same address.
I guess I could get around the whole mess by estrdup'ing string parameters
that this behavior apply's to, but should I really have to do that?
Thanks,
Dave Muse