]> granicus.if.org Git - php/commitdiff
Don't check number of args in msgfmt_do_format
authorGustavo André dos Santos Lopes <cataphract@php.net>
Sun, 13 May 2012 16:27:14 +0000 (18:27 +0200)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Sun, 13 May 2012 19:54:55 +0000 (20:54 +0100)
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.

ext/intl/msgformat/msgformat_format.c

index 25bdf3691af9b4a6f4cae6af08cc0d474b20c175..821adad094cad218dafb9fe6b6afb31b48782dd0 100755 (executable)
@@ -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,