com php-src: Don't check number of args in msgfmt_do_format : ext/intl/msgformat/msgformat_format.c

From: Date: Sun, 13 May 2012 19:54:55 +0000
Subject: com php-src: Don't check number of args in msgfmt_do_format : ext/intl/msgformat/msgformat_format.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-69050@lists.php.net to get a copy of this message
Commit: 43ff66e0953e3664de11ffa7af27c695057cc4d6 Author: Gustavo André dos Santos Lopes <cataphract@php.net> Sun, 13 May 2012 18:27:14 +0200 Parents: 0295ed7d225dcd9f5cbd21cfb335912a87af894d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=43ff66e0953e3664de11ffa7af27c695057cc4d6 Log: Don't check number of args in msgfmt_do_format The check does not work reliably across ICU versions when named arguments are added to the mix. For instance, for recent versions of ICU like 49, a pattern like "{foo,number} {foo}", has 0 returned from umsg_format_arg_count(), but for ICU 4.0, this returns 2. Changed paths: M ext/intl/msgformat/msgformat_format.c Diff: diff --git a/ext/intl/msgformat/msgformat_format.c b/ext/intl/msgformat/msgformat_format.c index 25bdf36..821adad 100755 --- a/ext/intl/msgformat/msgformat_format.c +++ b/ext/intl/msgformat/msgformat_format.c @@ -41,17 +41,6 @@ static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *ret count = zend_hash_num_elements(Z_ARRVAL_P(args)); - /* umsg_format_arg_count() always returns 0 for named argument patterns, - * so this check is ignored and un-substituted {name} strings - * in a pattern are returned unmodified. */ - if (count < umsg_format_arg_count(MSG_FORMAT_OBJECT(mfo))) { - /* Not enough aguments for format! */ - intl_errors_set(INTL_DATA_ERROR_P(mfo), U_ILLEGAL_ARGUMENT_ERROR, - "msgfmt_format: not enough parameters", 0 TSRMLS_CC); - RETVAL_FALSE; - return; - } - ALLOC_HASHTABLE(args_copy); zend_hash_init(args_copy, count, NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(args_copy, Z_ARRVAL_P(args), (copy_ctor_func_t)zval_add_ref,

« previous php.cvs (#69050) next »