Re: Translating optional zval ** with zend_parse_parameters() to PHP 7
| From: | Kalle Sommer Nielsen | Date: | Fri, 25 Nov 2016 20:43:02 +0000 |
| Subject: | Re: Translating optional zval ** with zend_parse_parameters() to PHP 7 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97192@lists.php.net to get a copy of this message | ||
2016-11-25 13:30 GMT+01:00 Thomas Hruska <thruska@cubiclesoft.com>:
> I need to be able to *modify* the original variable that was passed in. I already use
> "|l" and zend_long
> elsewhere in the extension
Ah my bad I misread it!
In that case take a look at where such is implemented in php-src,
dns_get_record() is an example despite the slightly clouded code:
http://git.php.net/?p=php-src.git;a=blob;f=ext/standard/dns.c;h=f92015eee90d3e93a801e93d6381d89923825166;hb=refs/heads/master#l1011
See $weight_list:
- Check if the argument is passed
- zval_dtor()
- Populate it (ZVAL_LONG is the same)
The main difference from your code is to use 'z' (lower case) in ZPP,
and then use zval* (which is what 'z' returns).
I'm not at my dev machine, so I cannot test it but that should be how it goes
--
regards,
Kalle Sommer Nielsen
kalle@php.net