Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
Hi Antony, Lukas, - Original Message - From: "Lukas Kahwe Smith" Sent: Monday, June 08, 2009 On 08.06.2009, at 09:26, Antony Dovgal wrote: On 05.06.2009 21:15, Matt Wilmas wrote: ext/standard/tests/strings/chunk_split_variation2.phpt ext/standard/tests/strings/chunk_split_variation5.phpt ext/standard/tests/strings/chunk_split_variation8.phpt It looks like these should also be failing with 5.2 on 64-bit? Well, they don't. Do you have the diffs to show? Thanks. Comment below... I'll leave them as-is for now then... Some options: Skip them on 64-bit? variation2 could have a 64-bit version added. variation5/8 look like the same thing (and don't get why they reference Bug #42796). Their logic for the test value (PHP_INT_MAX * 3) is flawed anyway with the old (err, formerly new) double->long conversion method, but that could be changed to get the same result cross-platform... Sounds like we have a BC issue? Nah, just something isolated with these tests it seems. (All other tests are presumably fine.) The double->int conversion method on 64-bit is exactly the same as 5.2, so... Looking at those chunk_split() tests quickly again, variation2 is the same in 5.2 and 5.3 for anything related to dval->lval conversion. And the duplicate variation5/8, I do see now why the one iteration would fail on 64-bit (if that's the only part failing). However, on those 2 tests, I think it's *not possible* for it to pass with 5.2 on 64-bit (at the same iteration). No way, AFAICT. :-/ regards, Lukas Kahwe Smith m...@pooteeweet.org - Matt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
On 08.06.2009, at 09:26, Antony Dovgal wrote: On 05.06.2009 21:15, Matt Wilmas wrote: ext/standard/tests/strings/chunk_split_variation2.phpt ext/standard/tests/strings/chunk_split_variation5.phpt ext/standard/tests/strings/chunk_split_variation8.phpt It looks like these should also be failing with 5.2 on 64-bit? Well, they don't. I'll leave them as-is for now then... Some options: Skip them on 64-bit? variation2 could have a 64-bit version added. variation5/8 look like the same thing (and don't get why they reference Bug #42796). Their logic for the test value (PHP_INT_MAX * 3) is flawed anyway with the old (err, formerly new) double->long conversion method, but that could be changed to get the same result cross-platform... Sounds like we have a BC issue? regards, Lukas Kahwe Smith m...@pooteeweet.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
On 05.06.2009 21:15, Matt Wilmas wrote: >> ext/standard/tests/strings/chunk_split_variation2.phpt >> ext/standard/tests/strings/chunk_split_variation5.phpt >> ext/standard/tests/strings/chunk_split_variation8.phpt > > It looks like these should also be failing with 5.2 on 64-bit? Well, they don't. > I'll leave > them as-is for now then... Some options: > > Skip them on 64-bit? variation2 could have a 64-bit version added. > variation5/8 look like the same thing (and don't get why they reference Bug > #42796). Their logic for the test value (PHP_INT_MAX * 3) is flawed anyway > with the old (err, formerly new) double->long conversion method, but that > could be changed to get the same result cross-platform... -- Wbr, Antony Dovgal --- http://pinba.org - realtime statistics for PHP -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
Hi Tony, Thanks, comments below... - Original Message - From: "Antony Dovgal" Sent: Friday, June 05, 2009 On 04.06.2009 22:18, Matt Wilmas wrote: mattwil Thu Jun 4 18:18:47 2009 UTC New failed tests: ext/standard/tests/array/array_slice_variation2.phpt ext/standard/tests/array/array_slice_variation3.phpt ext/standard/tests/math/decbin_variation1_64bit.phpt ext/standard/tests/math/dechex_variation1_64bit.phpt ext/standard/tests/math/decoct_variation1_64bit.phpt Made a couple mistakes there with my guessing for the 64-bit tests... array_slice2/3 are 32-/64-bit only, respectively, in 5.2 though they're testing different things. Hmm. Well, I changed them to match 5.2. ext/standard/tests/strings/chunk_split_variation2.phpt ext/standard/tests/strings/chunk_split_variation5.phpt ext/standard/tests/strings/chunk_split_variation8.phpt It looks like these should also be failing with 5.2 on 64-bit? I'll leave them as-is for now then... Some options: Skip them on 64-bit? variation2 could have a 64-bit version added. variation5/8 look like the same thing (and don't get why they reference Bug #42796). Their logic for the test value (PHP_INT_MAX * 3) is flawed anyway with the old (err, formerly new) double->long conversion method, but that could be changed to get the same result cross-platform... -- Wbr, Antony Dovgal - Matt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
On 04.06.2009 22:18, Matt Wilmas wrote: > mattwil Thu Jun 4 18:18:47 2009 UTC New failed tests: ext/standard/tests/array/array_slice_variation2.phpt ext/standard/tests/array/array_slice_variation3.phpt ext/standard/tests/math/decbin_variation1_64bit.phpt ext/standard/tests/math/dechex_variation1_64bit.phpt ext/standard/tests/math/decoct_variation1_64bit.phpt ext/standard/tests/strings/chunk_split_variation2.phpt ext/standard/tests/strings/chunk_split_variation5.phpt ext/standard/tests/strings/chunk_split_variation8.phpt -- Wbr, Antony Dovgal --- http://pinba.org - realtime statistics for PHP -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
Matt Wilmas wrote: Sure! It makes no difference to me at all. Should I just remove that part completely? I didn't know if it would even be used -- just thinking more of "it's there if someone wants the option..." Do you have examples of functions that might have a use for that? -Andrei -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
Hi Andrei, - Original Message - From: "Andrei Zmievski" Sent: Thursday, June 04, 2009 Hmm, can we use something other than L? We were hoping to reserve L for use in PHP 6 for bigint numbers. Sure! It makes no difference to me at all. Should I just remove that part completely? I didn't know if it would even be used -- just thinking more of "it's there if someone wants the option..." -Andrei - Matt Matt Wilmas wrote: mattwil Thu Jun 4 18:18:47 2009 UTC Modified files: /php-src README.PARAMETER_PARSING_API /ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h zend_vm_def.h zend_vm_execute.h /php-src/win32/build config.w32 Log: Restored double->long conversion behavior to that of PHP 5.2 (on most platforms) and prior: * Out-of-range numbers overflow/preserve least significant bits (no LONG_MAX/MIN limit) * See bug #42868 (presumably-rare platform with different results in 5.2) * On 32-bit platforms with 64-bit long type, a zend_long64 cast has been added, otherwise it's the same as 5.2 * Use this conversion method everywhere instead of some plain (long) casts Added 'L' parameter parsing specifier to ensure a LONG_MAX/MIN limit: * Essentially what 5.3's new conversion was doing in most cases * Functions with "limit" or "length" type params could be updated to use this, and prevent confusing overflow behavior with huge numbers (*also* in 5.2) - See bug #47854, for example; or even #42868 again # Test updates coming -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h ze
Hmm, can we use something other than L? We were hoping to reserve L for use in PHP 6 for bigint numbers. -Andrei Matt Wilmas wrote: mattwil Thu Jun 4 18:18:47 2009 UTC Modified files: /php-src README.PARAMETER_PARSING_API /ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h zend_vm_def.h zend_vm_execute.h /php-src/win32/build config.w32 Log: Restored double->long conversion behavior to that of PHP 5.2 (on most platforms) and prior: * Out-of-range numbers overflow/preserve least significant bits (no LONG_MAX/MIN limit) * See bug #42868 (presumably-rare platform with different results in 5.2) * On 32-bit platforms with 64-bit long type, a zend_long64 cast has been added, otherwise it's the same as 5.2 * Use this conversion method everywhere instead of some plain (long) casts Added 'L' parameter parsing specifier to ensure a LONG_MAX/MIN limit: * Essentially what 5.3's new conversion was doing in most cases * Functions with "limit" or "length" type params could be updated to use this, and prevent confusing overflow behavior with huge numbers (*also* in 5.2) - See bug #47854, for example; or even #42868 again # Test updates coming -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API /win32/build config.w32 ZendEngine2 Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h zend_v
mattwil Thu Jun 4 18:18:47 2009 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API /ZendEngine2Zend.m4 zend_API.c zend_compile.c zend_execute.c zend_execute_API.c zend_operators.c zend_operators.h zend_vm_def.h zend_vm_execute.h /php-src/win32/buildconfig.w32 Log: Restored double->long conversion behavior to that of PHP 5.2 (on most platforms) and prior: * Out-of-range numbers overflow/preserve least significant bits (no LONG_MAX/MIN limit) * See bug #42868 (presumably-rare platform with different results in 5.2) * On 32-bit platforms with 64-bit long type, a zend_long64 cast has been added, otherwise it's the same as 5.2 * Use this conversion method everywhere instead of some plain (long) casts Added 'L' parameter parsing specifier to ensure a LONG_MAX/MIN limit: * Essentially what 5.3's new conversion was doing in most cases * Functions with "limit" or "length" type params could be updated to use this, and prevent confusing overflow behavior with huge numbers (*also* in 5.2) - See bug #47854, for example; or even #42868 again # Test updates coming http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.26&r2=1.27&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.26 php-src/README.PARAMETER_PARSING_API:1.27 --- php-src/README.PARAMETER_PARSING_API:1.26 Mon Nov 24 19:18:34 2008 +++ php-src/README.PARAMETER_PARSING_APIThu Jun 4 18:18:46 2009 @@ -48,6 +48,7 @@ h - array (returned as HashTable*) H - array or HASH_OF(object) (returned as HashTable*) l - long (long) + L - long, limits out-of-range numbers to LONG_MAX/LONG_MIN (long) o - object of any type (zval*) O - object of specific type given by class entry (zval*, zend_class_entry) r - resource (zval*) http://cvs.php.net/viewvc.cgi/ZendEngine2/Zend.m4?r1=1.69&r2=1.70&diff_format=u Index: ZendEngine2/Zend.m4 diff -u ZendEngine2/Zend.m4:1.69 ZendEngine2/Zend.m4:1.70 --- ZendEngine2/Zend.m4:1.69Tue May 19 11:40:05 2009 +++ ZendEngine2/Zend.m4 Thu Jun 4 18:18:46 2009 @@ -1,5 +1,5 @@ dnl -dnl $Id: Zend.m4,v 1.69 2009/05/19 11:40:05 lbarnaud Exp $ +dnl $Id: Zend.m4,v 1.70 2009/06/04 18:18:46 mattwil Exp $ dnl dnl This file contains Zend specific autoconf functions. dnl @@ -117,6 +117,38 @@ ZEND_FP_EXCEPT ZEND_CHECK_FLOAT_PRECISION + +dnl test whether double cast to long preserves least significant bits +AC_MSG_CHECKING(whether double cast to long preserves least significant bits) + +AC_TRY_RUN([ +#include + +int main() +{ + if (sizeof(long) == 4) { + double d = (double) LONG_MIN * LONG_MIN + 2e9; + + if ((long) d == 2e9 && (long) -d == -2e9) { + exit(0); + } + } else if (sizeof(long) == 8) { + double correct = 18e18 - ((double) LONG_MIN * -2); /* Subtract ULONG_MAX + 1 */ + + if ((long) 18e18 == correct) { /* On 64-bit, only check between LONG_MAX and ULONG_MAX */ + exit(0); + } + } + exit(1); +} +], [ + AC_DEFINE([ZEND_DVAL_TO_LVAL_CAST_OK], 1, [Define if double cast to long preserves least significant bits]) + AC_MSG_RESULT(yes) +], [ + AC_MSG_RESULT(no) +], [ + AC_MSG_RESULT(no) +]) ]) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.502&r2=1.503&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.502 ZendEngine2/zend_API.c:1.503 --- ZendEngine2/zend_API.c:1.502Mon May 25 14:32:13 2009 +++ ZendEngine2/zend_API.c Thu Jun 4 18:18:46 2009 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: zend_API.c,v 1.502 2009/05/25 14:32:13 felipe Exp $ */ +/* $Id: zend_API.c,v 1.503 2009/06/04 18:18:46 mattwil Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -343,6 +343,7 @@ switch (c) { case 'l': + case 'L': { long *p = va_arg(*va, long *); switch (Z_TYPE_PP(arg)) { @@ -354,7 +355,17 @@ if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { - *p = (long) d; + if (c == 'L') { + if (d > LONG_MAX) { + *p = LONG_MAX; +
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
stasMon Nov 24 19:18:35 2008 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: add object-compatible array modes http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.25&r2=1.26&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.25 php-src/README.PARAMETER_PARSING_API:1.26 --- php-src/README.PARAMETER_PARSING_API:1.25 Mon Aug 18 14:34:32 2008 +++ php-src/README.PARAMETER_PARSING_APIMon Nov 24 19:18:34 2008 @@ -39,12 +39,14 @@ instance of that class. a - array (zval*) + A - array or object (zval *) b - boolean (zend_bool) C - class (zend_class_entry*) d - double (double) f - function or array containing php method call info (returned as zend_fcall_info and zend_fcall_info_cache) h - array (returned as HashTable*) + H - array or HASH_OF(object) (returned as HashTable*) l - long (long) o - object of any type (zval*) O - object of specific type given by class entry (zval*, zend_class_entry) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
tony2001Mon Aug 18 14:34:32 2008 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: these are not bits, but bytes.. http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.24&r2=1.25&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.24 php-src/README.PARAMETER_PARSING_API:1.25 --- php-src/README.PARAMETER_PARSING_API:1.24 Mon Aug 18 13:09:32 2008 +++ php-src/README.PARAMETER_PARSING_APIMon Aug 18 14:34:32 2008 @@ -82,7 +82,7 @@ Note on 64bit compatibility --- Please do not forget that int and long are two different things on 64bit -OSes (int is 4bit and long is 8bit), so make sure you pass longs to "l" +OSes (int is 4 bytes and long is 8 bytes), so make sure you pass longs to "l" and ints to strings length (i.e. for "s" you need to pass char * and int), not the other way round! Remember: "l" is the only case when you need to pass long (and that's why -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
tony2001Mon Aug 18 13:09:33 2008 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: add note on 64bit compatibility and mention check_parameters.php http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.23&r2=1.24&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.23 php-src/README.PARAMETER_PARSING_API:1.24 --- php-src/README.PARAMETER_PARSING_API:1.23 Tue Nov 6 09:48:14 2007 +++ php-src/README.PARAMETER_PARSING_APIMon Aug 18 13:09:32 2008 @@ -78,6 +78,32 @@ ^ - returns original string type before conversion (only for 's' and 'u' specifiers) + +Note on 64bit compatibility +--- +Please do not forget that int and long are two different things on 64bit +OSes (int is 4bit and long is 8bit), so make sure you pass longs to "l" +and ints to strings length (i.e. for "s" you need to pass char * and int), +not the other way round! +Remember: "l" is the only case when you need to pass long (and that's why +it's "l", not "i" btw). + +Both mistakes cause memory corruptions and segfaults on 64bit OSes: +1) + char *str; + long str_len; /* XXX THIS IS WRONG!! Use int instead. */ + zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) + +2) + int num; /* XXX THIS IS WRONG!! Use long instead. */ + zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) + +If you're in doubt, use check_parameters.php script to the parameters +and their types (it can be found in ./scripts/dev/ directory of PHP sources): + +# php ./scripts/dev/check_parameters.php /path/to/your/sources/ + + Examples /* Gets a long, a string and its length, and a zval */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
janiTue Nov 6 09:48:14 2007 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: - Clarify the difference with * and + args http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.22&r2=1.23&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.22 php-src/README.PARAMETER_PARSING_API:1.23 --- php-src/README.PARAMETER_PARSING_API:1.22 Fri Sep 28 22:04:28 2007 +++ php-src/README.PARAMETER_PARSING_APITue Nov 6 09:48:14 2007 @@ -61,7 +61,8 @@ behaves like 'u' and in nonunicode mode it behaves like 's'. z - the actual zval (zval*) Z - the actual zval (zval**) - * - variable arguments list + * - variable arguments list (0 or more) + + - variable arguments list (1 or more) The following characters also have a meaning in the specifier string: | - indicates that the remaining parameters are optional, they -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
johannesFri Sep 28 22:04:28 2007 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: - Fix type in example http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.21&r2=1.22&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.21 php-src/README.PARAMETER_PARSING_API:1.22 --- php-src/README.PARAMETER_PARSING_API:1.21 Wed May 23 18:48:16 2007 +++ php-src/README.PARAMETER_PARSING_APIFri Sep 28 22:04:28 2007 @@ -93,7 +93,7 @@ /* Gets an object of class specified by my_ce, and an optional double. */ zval *obj; double d = 0.5; -zend_class_entry my_ce; +zend_class_entry *my_ce; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d", &obj, my_ce, &d) == FAILURE) { return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
helly Wed May 23 18:48:16 2007 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: - Fix f http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.20&r2=1.21&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.20 php-src/README.PARAMETER_PARSING_API:1.21 --- php-src/README.PARAMETER_PARSING_API:1.20 Mon Feb 5 17:59:11 2007 +++ php-src/README.PARAMETER_PARSING_APIWed May 23 18:48:16 2007 @@ -43,7 +43,7 @@ C - class (zend_class_entry*) d - double (double) f - function or array containing php method call info (returned as - zend_fcall_info* and zend_fcall_info_cache*) + zend_fcall_info and zend_fcall_info_cache) h - array (returned as HashTable*) l - long (long) o - object of any type (zval*) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
andrei Mon Feb 5 17:59:11 2007 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: Update http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.19&r2=1.20&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.19 php-src/README.PARAMETER_PARSING_API:1.20 --- php-src/README.PARAMETER_PARSING_API:1.19 Fri Feb 2 21:49:37 2007 +++ php-src/README.PARAMETER_PARSING_APIMon Feb 5 17:59:11 2007 @@ -69,9 +69,9 @@ will not be touched by the parsing function if they are not passed to it. / - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows -! - the parameter it follows can be of specified type or NULL (only applies -to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results -pointer is set to NULL as well. +! - the parameter it follows can be of specified type or NULL (applies + to all specifiers except for 'b', 'l', and 'd'). If NULL is passed, the + results pointer is set to NULL as well. & - alternate format (currently used for 's' only to specify a converter to use when converting from Unicode strings) ^ - returns original string type before conversion (only for 's' and 'u' -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
helly Tue Dec 19 22:24:28 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: - x was added toparameter parsing api http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.17&r2=1.18&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.17 php-src/README.PARAMETER_PARSING_API:1.18 --- php-src/README.PARAMETER_PARSING_API:1.17 Wed Aug 2 17:36:40 2006 +++ php-src/README.PARAMETER_PARSING_APITue Dec 19 22:24:28 2006 @@ -57,6 +57,8 @@ coalesces all T parameters to common type (Unicode or binary) u - unicode (UChar*, int) U - Unicode string, does not allow conversion from binary strings + x - Unicode or binary string depending on UG(unicode). In unicode this + behaves like 'u' and in nonunicode mode it behaves like 's'. z - the actual zval (zval*) Z - the actual zval (zval**) * - variable arguments list -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
andrei Wed Aug 2 17:36:40 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.16&r2=1.17&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.16 php-src/README.PARAMETER_PARSING_API:1.17 --- php-src/README.PARAMETER_PARSING_API:1.16 Thu Jul 20 15:46:26 2006 +++ php-src/README.PARAMETER_PARSING_APIWed Aug 2 17:36:40 2006 @@ -38,38 +38,40 @@ has to be provided on input and is used to verify the PHP parameter is an instance of that class. - a - array (zval*) - b - boolean (zend_bool) - C - class (zend_class_entry*) - d - double (double) - f - function or array containing php method call info (returned as - zend_fcall_info* and zend_fcall_info_cache*) - h - array (returned as HashTable*) - l - long (long) - o - object of any type (zval*) - O - object of specific type given by class entry (zval*, zend_class_entry) - r - resource (zval*) - s - string (with possible null bytes) and its length (char*, int) - S - binary string, does not allow conversion from Unicode strings - t - text (zstr (string union), int (length), zend_uchar (IS_STRING/..)) + a - array (zval*) + b - boolean (zend_bool) + C - class (zend_class_entry*) + d - double (double) + f - function or array containing php method call info (returned as + zend_fcall_info* and zend_fcall_info_cache*) + h - array (returned as HashTable*) + l - long (long) + o - object of any type (zval*) + O - object of specific type given by class entry (zval*, zend_class_entry) + r - resource (zval*) + s - string (with possible null bytes) and its length (char*, int) + S - binary string, does not allow conversion from Unicode strings + t - text (zstr (string union), int (length), zend_uchar (IS_STRING/..)) accepts either Unicode or binary string - T - text (zstr (string union), int (length), zend_uchar (IS_STRING/..)) + T - text (zstr (string union), int (length), zend_uchar (IS_STRING/..)) coalesces all T parameters to common type (Unicode or binary) - u - unicode (UChar*, int) - U - Unicode string, does not allow conversion from binary strings - z - the actual zval (zval*) - Z - the actual zval (zval**) + u - unicode (UChar*, int) + U - Unicode string, does not allow conversion from binary strings + z - the actual zval (zval*) + Z - the actual zval (zval**) * - variable arguments list The following characters also have a meaning in the specifier string: - | - indicates that the remaining parameters are optional, they - should be initialized to default values by the extension since they - will not be touched by the parsing function if they are not - passed to it. - / - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows - ! - the parameter it follows can be of specified type or NULL (only applies - to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results - pointer is set to NULL as well. +| - indicates that the remaining parameters are optional, they +should be initialized to default values by the extension since they +will not be touched by the parsing function if they are not +passed to it. +/ - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows +! - the parameter it follows can be of specified type or NULL (only applies +to 'a', 'o', 'O', 'r', and 'z'). If NULL is passed, the results +pointer is set to NULL as well. +& - alternate format (currently used for 's' only to specify a converter to +use when converting from Unicode strings) Examples @@ -79,8 +81,8 @@ int s_len; zval *param; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lsz", - &l, &s, &s_len, ¶m) == FAILURE) { - return; + &l, &s, &s_len, ¶m) == FAILURE) { +return; } @@ -89,8 +91,8 @@ double d = 0.5; zend_class_entry my_ce; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|d", - &obj, my_ce, &d) == FAILURE) { - return; + &obj, my_ce, &d) == FAILURE) { +return; } @@ -99,16 +101,25 @@ zval *obj; zval *arr; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o!a", - &obj, &arr) == FAILURE) { - return; + &obj, &arr) == FAILURE) { +return; } /* Gets a separated array which can also be null. */ zval *arr; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!", - &arr) == FAILURE) { - return; + &arr) == FAILURE) { +return; +} + + +/* Gets a binary string in
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
andrei Thu Jul 20 15:46:26 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: Fix void* -> zstr http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.15&r2=1.16&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.15 php-src/README.PARAMETER_PARSING_API:1.16 --- php-src/README.PARAMETER_PARSING_API:1.15 Wed Jul 19 17:51:49 2006 +++ php-src/README.PARAMETER_PARSING_APIThu Jul 20 15:46:26 2006 @@ -51,9 +51,9 @@ r - resource (zval*) s - string (with possible null bytes) and its length (char*, int) S - binary string, does not allow conversion from Unicode strings - t - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) + t - text (zstr (string union), int (length), zend_uchar (IS_STRING/..)) accepts either Unicode or binary string - T - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) + T - text (zstr (string union), int (length), zend_uchar (IS_STRING/..)) coalesces all T parameters to common type (Unicode or binary) u - unicode (UChar*, int) U - Unicode string, does not allow conversion from binary strings -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
helly Wed Jul 12 07:31:56 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: - Reorder and add missing http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.11&r2=1.12&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.11 php-src/README.PARAMETER_PARSING_API:1.12 --- php-src/README.PARAMETER_PARSING_API:1.11 Tue Jul 11 23:05:47 2006 +++ php-src/README.PARAMETER_PARSING_APIWed Jul 12 07:31:56 2006 @@ -38,23 +38,25 @@ has to be provided on input and is used to verify the PHP parameter is an instance of that class. - l - long (long) + a - array (zval*) + b - boolean (zend_bool) + C - class (zend_class_entry*) d - double (double) + f - function or array containing php method call info (returned as + zend_fcall_info* and zend_fcall_info_cache*) + h - array (returned as HashTable*) + l - long (long) + o - object of any type (zval*) + O - object of specific type given by class entry (zval*, zend_class_entry) + r - resource (zval*) s - string (with possible null bytes) and its length (char*, int) - u - Unicode (UChar*, int) + S - binary string, does not allow conversion from Unicode strings t - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) accepts either Unicode or binary string T - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) coalesces all T parameters to common type (Unicode or binary) - U - Unicode string, does not allow conversion from binary strings - S - binary string, does not allow conversion from Unicode strings - b - boolean (zend_bool) - r - resource (zval*) - a - array (zval*) - h - array (returned as HashTable*) - o - object of any type (zval*) - O - object of specific type given by class entry (zval*, zend_class_entry) - C - class (zend_class_entry*) + u - unicode (UChar*, int) + U - Unicode string, does not allow conversion from binary strings z - the actual zval (zval*) Z - the actual zval (zval**) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
andrei Tue Jul 11 23:05:47 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: Explain new specifiers http://cvs.php.net/viewvc.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.10&r2=1.11&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.10 php-src/README.PARAMETER_PARSING_API:1.11 --- php-src/README.PARAMETER_PARSING_API:1.10 Wed Jan 25 00:20:39 2006 +++ php-src/README.PARAMETER_PARSING_APITue Jul 11 23:05:47 2006 @@ -41,11 +41,13 @@ l - long (long) d - double (double) s - string (with possible null bytes) and its length (char*, int) - u - unicode (UChar*, int) + u - Unicode (UChar*, int) t - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) - actual type is controled by ini unicode setting + accepts either Unicode or binary string T - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) - actual type controlled by first s or u + coalesces all T parameters to common type (Unicode or binary) + U - Unicode string, does not allow conversion from binary strings + S - binary string, does not allow conversion from Unicode strings b - boolean (zend_bool) r - resource (zval*) a - array (zval*) @@ -107,7 +109,47 @@ } -/* Get only the first three parameters (useful for varargs functions). */ +/* Gets a Unicode string */ +UChar *str; +int len; + +if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, &len) == FAILURE) { + return; +} + + +/* Gets a Unicode or binary string */ +void *str; +int len; +zend_uchar type; + +if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &str, &len, &type) == FAILURE) { + return; +} +if (type == IS_UNICODE) { + /* process Unicode string */ +} else { + /* process binary string */ +} + + +/* Gets two string parameters, both of which will be guaranteed to be of the same type */ +void *str1, *str2; +int len1, len2; +zend_uchar type1, type2; + +if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &str1, &len1, + &type1, &str2, &len2, &type2) == FAILURE) { + return; +} +if (type1 == IS_UNICODE) { + /* process as Unicode, str2 is guaranteed to be Unicode as well */ +} else { + /* process as binary string, str2 is guaranteed to be the same */ +} + + +/* Gets only the first three parameters (useful for varargs functions). */ zval *z; zend_bool b; zval *r; @@ -140,3 +182,4 @@ return; } + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
Hello Andrei, ic, can you pleas correct then :-) marcus Wednesday, January 25, 2006, 1:45:06 AM, you wrote: > This is not correct. The common type can be controlled by any T > argument, with preference given to IS_UNICODE. > -Andrei > On Jan 24, 2006, at 4:20 PM, Marcus Boerger wrote: >> T- text (void * (char*/Uchar*), int (length), zend_uchar >> (IS_STRING/..)) >> + actual type controlled by first s or u Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
This is not correct. The common type can be controlled by any T argument, with preference given to IS_UNICODE. -Andrei On Jan 24, 2006, at 4:20 PM, Marcus Boerger wrote: T - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) + actual type controlled by first s or u -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
Hello Antony, hey you were faster than me, all my last commits were blocked because of you :-) Wednesday, January 25, 2006, 12:39:09 AM, you wrote: > tony2001Tue Jan 24 23:39:09 2006 UTC > Modified files: > /php-srcREADME.PARAMETER_PARSING_API > Log: > ws > > > http://cvs.php.net/viewcvs.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.8&r2=1.9&diff_format=u > Index: php-src/README.PARAMETER_PARSING_API > diff -u php-src/README.PARAMETER_PARSING_API:1.8 > php-src/README.PARAMETER_PARSING_API:1.9 > --- php-src/README.PARAMETER_PARSING_API:1.8Tue Jan 24 23:36:13 2006 > +++ php-src/README.PARAMETER_PARSING_APITue Jan 24 23:39:09 2006 > @@ -37,7 +37,7 @@ > b - boolean, stored in zend_bool > r - resource (stored in zval) > a - array > - h - array (returned as HashTable*) > + h - array (returned as HashTable*) > o - object (of any type) > O - object (of specific type, specified by class entry) > z - the actual zval Best regards, Marcus -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
helly Wed Jan 25 00:20:39 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: . Update docu http://cvs.php.net/viewcvs.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.9&r2=1.10&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.9 php-src/README.PARAMETER_PARSING_API:1.10 --- php-src/README.PARAMETER_PARSING_API:1.9Tue Jan 24 23:39:09 2006 +++ php-src/README.PARAMETER_PARSING_APIWed Jan 25 00:20:39 2006 @@ -31,16 +31,30 @@ Type specifiers --- - l - long - d - double - s - string (with possible null bytes) and its length - b - boolean, stored in zend_bool - r - resource (stored in zval) - a - array + The following list shows the type specifier, its meaning and the parameter + types that need to be passed by address. All passed paramaters are set + if the PHP parameter is non optional and untouched if optional and the + parameter is not present. The only exception is O where the zend_class_entry* + has to be provided on input and is used to verify the PHP parameter is an + instance of that class. + + l - long (long) + d - double (double) + s - string (with possible null bytes) and its length (char*, int) + u - unicode (UChar*, int) + t - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) + actual type is controled by ini unicode setting + T - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..)) + actual type controlled by first s or u + b - boolean (zend_bool) + r - resource (zval*) + a - array (zval*) h - array (returned as HashTable*) - o - object (of any type) - O - object (of specific type, specified by class entry) - z - the actual zval + o - object of any type (zval*) + O - object of specific type given by class entry (zval*, zend_class_entry) + C - class (zend_class_entry*) + z - the actual zval (zval*) + Z - the actual zval (zval**) The following characters also have a meaning in the specifier string: | - indicates that the remaining parameters are optional, they -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
tony2001Tue Jan 24 23:39:09 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: ws http://cvs.php.net/viewcvs.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.8&r2=1.9&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.8 php-src/README.PARAMETER_PARSING_API:1.9 --- php-src/README.PARAMETER_PARSING_API:1.8Tue Jan 24 23:36:13 2006 +++ php-src/README.PARAMETER_PARSING_APITue Jan 24 23:39:09 2006 @@ -37,7 +37,7 @@ b - boolean, stored in zend_bool r - resource (stored in zval) a - array - h - array (returned as HashTable*) + h - array (returned as HashTable*) o - object (of any type) O - object (of specific type, specified by class entry) z - the actual zval -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src / README.PARAMETER_PARSING_API
helly Tue Jan 24 23:36:13 2006 UTC Modified files: /php-srcREADME.PARAMETER_PARSING_API Log: - Update docu http://cvs.php.net/viewcvs.cgi/php-src/README.PARAMETER_PARSING_API?r1=1.7&r2=1.8&diff_format=u Index: php-src/README.PARAMETER_PARSING_API diff -u php-src/README.PARAMETER_PARSING_API:1.7 php-src/README.PARAMETER_PARSING_API:1.8 --- php-src/README.PARAMETER_PARSING_API:1.7Fri Jan 3 10:39:22 2003 +++ php-src/README.PARAMETER_PARSING_APITue Jan 24 23:36:13 2006 @@ -37,6 +37,7 @@ b - boolean, stored in zend_bool r - resource (stored in zval) a - array + h - array (returned as HashTable*) o - object (of any type) O - object (of specific type, specified by class entry) z - the actual zval -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php