From: Dmitry Stogov Date: Tue, 1 Jul 2008 10:01:09 +0000 (+0000) Subject: Use new parameter parsing API X-Git-Tag: php-5.3.0alpha1~546 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7938051d49458d16fdb9be85f0cfa1ee3b1cadf;p=php Use new parameter parsing API --- diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c index 2d81fae2a5..5d023da1ab 100644 --- a/ext/standard/formatted_print.c +++ b/ext/standard/formatted_print.c @@ -379,16 +379,13 @@ php_formatted_print(int ht, int *len, int use_array, int format_offset TSRMLS_DC char *format, *result, padding; int always_sign; - argc = ZEND_NUM_ARGS(); + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &args, &argc) == FAILURE) { + return NULL; + } /* verify the number of args */ if ((use_array && argc != (2 + format_offset)) || (!use_array && argc < (1 + format_offset))) { - WRONG_PARAM_COUNT_WITH_RETVAL(NULL); - } - 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); } diff --git a/ext/standard/tests/strings/fprintf_error.phpt b/ext/standard/tests/strings/fprintf_error.phpt index 5fe3ff1442..ccc37407e8 100644 --- a/ext/standard/tests/strings/fprintf_error.phpt +++ b/ext/standard/tests/strings/fprintf_error.phpt @@ -20,12 +20,12 @@ echo "Done\n"; --EXPECTF-- *** Testing Error Conditions *** -Warning: fprintf() expects at least %d parameters, %d given in %s on line %d +Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d NULL -Warning: fprintf() expects at least %d parameters, %d given in %s on line %d +Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d NULL -Warning: fprintf() expects at least %d parameters, %d given in %s on line %d +Warning: Wrong parameter count for fprintf() in %sfprintf_error.php on line %d NULL Done