]> granicus.if.org Git - php/commitdiff
Set global error if insufficient numeric args. WS.
authorGustavo André dos Santos Lopes <cataphract@php.net>
Sat, 5 May 2012 22:48:17 +0000 (00:48 +0200)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Sun, 13 May 2012 19:53:05 +0000 (20:53 +0100)
ext/intl/msgformat/msgformat_format.c
ext/intl/msgformat/msgformat_helpers.cpp
ext/intl/tests/calendar_getErrorCode_getErrorMessage_basic.phpt

index d88bc00181e8fd37211ab6dcbe06da9d933de5a0..099dbcb4b6e7a229a87c0d747fc660f0c68687d0 100755 (executable)
@@ -44,10 +44,10 @@ static void msgfmt_do_format(MessageFormatter_object *mfo, zval *args, zval *ret
     /* 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))) {
+       if (count < umsg_format_arg_count(MSG_FORMAT_OBJECT(mfo))) {
                /* Not enough aguments for format! */
-               intl_error_set( INTL_DATA_ERROR_P(mfo), U_ILLEGAL_ARGUMENT_ERROR,
-                       "msgfmt_format: not enough parameters", 0 TSRMLS_CC );
+               intl_errors_set(INTL_DATA_ERROR_P(mfo), U_ILLEGAL_ARGUMENT_ERROR,
+                       "msgfmt_format: not enough parameters", 0 TSRMLS_CC);
                RETVAL_FALSE;
                return;
        }
index 5c114e8302cfe3260db155a027b440ec970608db..503dca9ad9b800a86c6d0cb48c25a2be4e7b9bc6 100755 (executable)
@@ -117,14 +117,14 @@ static HashTable *umsg_parse_format(const MessagePattern& mp, UErrorCode& uec)
        parts_count = mp.countParts();
 
        // See MessageFormat::cacheExplicitFormats()
-    /*
-     * Looking through the pattern, go to each arg_start part type.
-     * The arg-typeof that tells us the argument type (simple, complicated)
-     * then the next part is either the arg_name or arg number
-     * and then if it's simple after that there could be a part-type=arg-type
+       /*
+        * Looking through the pattern, go to each arg_start part type.
+        * The arg-typeof that tells us the argument type (simple, complicated)
+        * then the next part is either the arg_name or arg number
+        * and then if it's simple after that there could be a part-type=arg-type
         * while substring will tell us number, spellout, etc.
-     * If the next thing isn't an arg-type then assume string.
-    */
+        * If the next thing isn't an arg-type then assume string.
+       */
        /* The last two "parts" can at most be ARG_LIMIT and MSG_LIMIT
         * which we need not examine. */
        for (int32_t i = 0; i < parts_count - 2 && U_SUCCESS(uec); i++) {
@@ -226,7 +226,7 @@ static HashTable *umsg_parse_format(const MessagePattern& mp, UErrorCode& uec)
                }
 
                *storedType = type;
-    } /* visiting each part */
+       } /* visiting each part */
 
        if (U_FAILURE(uec)) {
                zend_hash_destroy(ret);
index 7b4104bf4ee21ebd1b4291d63a40f77ff10201c6..71c053492f15c5f27ddebf67a61c7167743666a9 100644 (file)
@@ -40,4 +40,4 @@ int(1)
 int(1)
 string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
 string(81) "intlcal_field_difference: Call to ICU method has failed: U_ILLEGAL_ARGUMENT_ERROR"
-==DONE==\r
+==DONE==