Use new parameter parsing API

This commit is contained in:
Dmitry Stogov 2008-07-01 10:01:09 +00:00
parent c79df56ac6
commit f7938051d4
2 changed files with 6 additions and 9 deletions

View File

@ -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);
}

View File

@ -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