Re: zend_get_parameters_ex rework

From: Date: Thu, 12 Feb 2015 11:35:40 +0000
Subject: Re: zend_get_parameters_ex rework
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-82523@lists.php.net to get a copy of this message
On Wed, Feb 11, 2015 at 1:43 PM, Lester Caine <lester@lsces.co.uk> wrote: > On 10/02/15 14:31, Lester Caine wrote: > > in interbase/ibase_blobs.c > > > >> zval *blob_arg, *string_arg; > >> ibase_blob *ib_blob; > >> > >> RESET_ERRMSG; > >> > >> if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &blob_arg, > &string_arg) == FAILURE) { > >> WRONG_PARAM_COUNT; > >> } > >> > >> ZEND_FETCH_RESOURCE(ib_blob, ibase_blob *, blob_arg, -1, > "Interbase blob", le_blob); > > > > I've got that if changes to > > > >> if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, > "rr", &blob_arg, &string_arg)) { > >> return; > >> } > > > > But I suspect I need to change the *string_arg to a character string so > > 'rc' and add a string_len field. At least that is what I think I'm > > seeing from the samples I have found. > > OK I've got a patch for master, but I know that the changes are not > complete! > > http://hg.lsces.org.uk/hg/php-src/rev/8ec9101f59b6 > In ibase_blob_get you're declaring 'len_arg' as 'unsigned long'. If you're using the 'l' type in zpp you should use the 'zend_long' type instead - otherwise it will not work correctly on LLP64 (aka Windows) systems. > > I've still got a question about the &string_arg on line 1.9 and if it > should be changed to a string but that change needs working through the > following code. > Yes, this should be changed to a string. E.g. use the 'S' zpp modifier and declare the variable as 'zend_string *str'. Then modify the places where it is used from Z_STRVAL_P(...) to str->val and Z_STRLEN_P(...) to str->len. > Also is what I'm doing here php7 only? so should there be wrappers for a > PHP5 build? > Apart form a few special exceptions we keep PHP7-only codebases in php-src. They don't need to (and shouldn't) contain any compat code. As another tip: If you want to link to code in the PHP codebase, I recommend using http://lxr.php.net/xref/PHP_TRUNK/ instead of GitHub - lxr.php.net is cross-referenced, so you can click through function usages. Nikita

« previous php.internals (#82523) next »