From: Ilia Alshanetsky Date: Fri, 25 Jan 2008 01:31:10 +0000 (+0000) Subject: Adjust new chr() param handling to address chr("") calls X-Git-Tag: RELEASE_1_3_1~298 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a7b75eb116174b640a78597e530847e2c485788;p=php Adjust new chr() param handling to address chr("") calls --- diff --git a/ext/standard/string.c b/ext/standard/string.c index e232d5c1eb..41844a54e6 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -2604,9 +2604,14 @@ PHP_FUNCTION(chr) long c; char temp[2]; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == FAILURE) { - return; + if (ZEND_NUM_ARGS() != 1) { + WRONG_PARAM_COUNT; } + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "l", &c) == FAILURE) { + c = 0; + } + temp[0] = (char)c; temp[1] = '\0';