Re: [PATCH] Add 'Z' flag to zend_parse_parameters*()
| From: | Andi Gutmans | Date: | Fri, 11 Jul 2003 11:26:23 +0000 |
| Subject: | Re: [PATCH] Add 'Z' flag to zend_parse_parameters*() | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-3357@lists.php.net to get a copy of this message | ||
I commited the patch (after a couple of whitespace fixes).
Thanks,
Andi
At 02:04 AM 11/7/2003 -0500, Josh Fuhs wrote:
The simple explanation is that it is functionality that was previously offered by get_parameters(), which is now deprecated. The long explanation is that I've been writing a database interface extension that has many functions that could potentially take as input any data type. These functions don't know what the type is supposed to be until it has done some analysis, after which, I would have to convert the parameter. From what I understand, if I use the "z" option and then convert to the necessary data type using convert_to_*(), I have improperly altered Zend internal data. If I used the "z/" option, I could use convert_to_*(), however, this forces a separation which may not be necessary (being a database interface, I want it to be as thin as possible). The convert_to_*_ex() function group is what I need. It checked the type, did the separation and conversion if necessary, and appropriately altered the refcount. The problem is that I needed a valid zval** (one that was accounted for in the refcount) to do this. I tried to solve this problem several different ways, each of which resulted in a segfault. I had been doing &((zval*)returned_from_zend_parse_parameters), so it was an unregistered zval**. Finally, I decided to read through the Zend code and came up with this solution. I would have just used get_parameters() if it wasn't declared deprecated. Plus, zend_parse_parameters() is nicer to work with. I tried to explain things as clearly as I understand them. If I'm mis-understanding something, please let me know. Josh Quoting Andi Gutmans <andi@zend.com>: I don't have any real problem with this patch. However, I didn't quite understand why you need it. Can you please remind me? Andi At 04:22 PM 10/7/2003 -0500, Josh Fuhs wrote:How will I know if this gets included in the CVS source repository? If it doesn't, could someone please explain why not and give me analternativesolution to my problem? I'm currently using the patched version of PHP and I don't want to upgrade unless I know this change is included. Thanks Josh Quoting Andi Gutmans <andi@zend.com>:"z".I don't quite understand how this is of added value over the existing-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpCan you please explain in more detail? Thanks, Andi At 07:05 PM 8/7/2003 -0500, fuhs@purdue.edu wrote:-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpOne more time. I hope it's not too obvious that I'm new at this :) This patch would add a 'Z' flag to zend_parse_parameters*(). Example:-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php#typdef zvar zval** zvar a_zvar; zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &zvar);Josh -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php