felipe Sun Aug 10 21:48:22 2008 UTC Modified files: /php-src/ext/standard formatted_print.c /php-src/ext/standard/tests/strings printf.phpt sprintf_error.phpt vfprintf_error4.phpt vsprintf_error.phpt Log: - New parameter parsing API (for *printf()) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.106&r2=1.107&diff_format=u Index: php-src/ext/standard/formatted_print.c diff -u php-src/ext/standard/formatted_print.c:1.106 php-src/ext/standard/formatted_print.c:1.107 --- php-src/ext/standard/formatted_print.c:1.106 Tue Jul 1 10:01:25 2008 +++ php-src/ext/standard/formatted_print.c Sun Aug 10 21:48:22 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: formatted_print.c,v 1.106 2008/07/01 10:01:25 dmitry Exp $ */ +/* $Id: formatted_print.c,v 1.107 2008/08/10 21:48:22 felipe Exp $ */ #include <math.h> /* modf() */ #include "php.h" @@ -980,16 +980,13 @@ int always_sign; zstr result_str; - argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return NULL_ZSTR; + } /* verify the number of args */ if ((use_array && argc != (2 + format_offset)) || (!use_array && argc < (1 + format_offset))) { - WRONG_PARAM_COUNT_WITH_RETVAL(NULL_ZSTR); - } - args = (zval ***)safe_emalloc(argc, sizeof(zval *), 0); - - if (zend_get_parameters_array_ex(argc, args) == FAILURE) { efree(args); WRONG_PARAM_COUNT_WITH_RETVAL(NULL_ZSTR); } @@ -1364,19 +1361,19 @@ PHP_FUNCTION(fprintf) { php_stream *stream; - zval **arg1, **arg2; + zval *arg1, **arg2; zstr result; int len, ret; if (ZEND_NUM_ARGS() < 2) { WRONG_PARAM_COUNT; } - - if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) { + + if (zend_parse_parameters(2 TSRMLS_CC, "rZ", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } - php_stream_from_zval(stream, arg1); + php_stream_from_zval(stream, &arg1); if (Z_TYPE_PP(arg2) != IS_STRING && Z_TYPE_PP(arg2) != IS_UNICODE) { convert_to_text_ex(arg2); @@ -1406,7 +1403,7 @@ PHP_FUNCTION(vfprintf) { php_stream *stream; - zval **arg1, **arg2; + zval *arg1, **arg2; zstr result; int len, ret; @@ -1414,11 +1411,11 @@ WRONG_PARAM_COUNT; } - if (zend_get_parameters_ex(2, &arg1, &arg2)==FAILURE) { + if (zend_parse_parameters(2 TSRMLS_CC, "rZ", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } - php_stream_from_zval(stream, arg1); + php_stream_from_zval(stream, &arg1); if (Z_TYPE_PP(arg2) != IS_STRING && Z_TYPE_PP(arg2) != IS_UNICODE) { convert_to_text_ex(arg2); http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/printf.phpt?r1=1.5&r2=1.6&diff_format=u Index: php-src/ext/standard/tests/strings/printf.phpt diff -u php-src/ext/standard/tests/strings/printf.phpt:1.5 php-src/ext/standard/tests/strings/printf.phpt:1.6 --- php-src/ext/standard/tests/strings/printf.phpt:1.5 Thu Apr 26 23:42:36 2007 +++ php-src/ext/standard/tests/strings/printf.phpt Sun Aug 10 21:48:22 2008 @@ -227,7 +227,7 @@ --EXPECTF-- *** Output for zero argument *** -Warning: Wrong parameter count for printf() in %s on line %d +Warning: printf() expects at least %d parameter, %d given in %s on line %d *** Output for insufficient number of arguments *** http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_error.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/standard/tests/strings/sprintf_error.phpt diff -u php-src/ext/standard/tests/strings/sprintf_error.phpt:1.3 php-src/ext/standard/tests/strings/sprintf_error.phpt:1.4 --- php-src/ext/standard/tests/strings/sprintf_error.phpt:1.3 Tue May 27 10:50:46 2008 +++ php-src/ext/standard/tests/strings/sprintf_error.phpt Sun Aug 10 21:48:22 2008 @@ -39,7 +39,7 @@ -- Testing sprintf() function with Zero arguments -- -Warning: Wrong parameter count for sprintf() in %s on line %d +Warning: sprintf() expects at least %d parameter, %d given in %s on line %d bool(false) -- Testing sprintf() function with less than expected no. of arguments -- http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vfprintf_error4.phpt?r1=1.2&r2=1.3&diff_format=u Index: php-src/ext/standard/tests/strings/vfprintf_error4.phpt diff -u php-src/ext/standard/tests/strings/vfprintf_error4.phpt:1.2 php-src/ext/standard/tests/strings/vfprintf_error4.phpt:1.3 --- php-src/ext/standard/tests/strings/vfprintf_error4.phpt:1.2 Sun Jun 22 13:31:10 2008 +++ php-src/ext/standard/tests/strings/vfprintf_error4.phpt Sun Aug 10 21:48:22 2008 @@ -36,7 +36,7 @@ --EXPECTF-- -- Testing vfprintf() function with other strangeties -- -Warning: vfprintf(): supplied argument is not a valid stream resource in %s on line %d +Warning: vfprintf() expects parameter 1 to be resource, Unicode string given in %s on line %d bool(false) Warning: vfprintf(): Zero is not a valid argument number in %s on line %d http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_error.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_error.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_error.phpt:1.3 php-src/ext/standard/tests/strings/vsprintf_error.phpt:1.4 --- php-src/ext/standard/tests/strings/vsprintf_error.phpt:1.3 Tue May 27 10:50:47 2008 +++ php-src/ext/standard/tests/strings/vsprintf_error.phpt Sun Aug 10 21:48:22 2008 @@ -31,7 +31,7 @@ -- Testing vsprintf() function with Zero arguments -- -Warning: Wrong parameter count for vsprintf() in %s on line %d +Warning: vsprintf() expects at least %d parameter, %d given in %s on line %d bool(false) -- Testing vsprintf() function with less than expected no. of arguments --
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php