]> granicus.if.org Git - php/commitdiff
refactor ctors, cleanup code
authorStanislav Malyshev <stas@php.net>
Tue, 22 Jul 2008 20:23:47 +0000 (20:23 +0000)
committerStanislav Malyshev <stas@php.net>
Tue, 22 Jul 2008 20:23:47 +0000 (20:23 +0000)
17 files changed:
ext/intl/collator/collator_class.h
ext/intl/collator/collator_create.c
ext/intl/dateformat/dateformat.c
ext/intl/dateformat/dateformat_attr.c
ext/intl/dateformat/dateformat_class.c
ext/intl/dateformat/dateformat_class.h
ext/intl/dateformat/dateformat_format.c
ext/intl/dateformat/dateformat_parse.c
ext/intl/formatter/formatter_main.c
ext/intl/intl_data.h
ext/intl/msgformat/msgformat.c
ext/intl/msgformat/msgformat_attr.c
ext/intl/msgformat/msgformat_data.c
ext/intl/msgformat/msgformat_format.c
ext/intl/msgformat/msgformat_parse.c
ext/intl/tests/formatter_fail.phpt
ext/intl/tests/msgfmt_fail.phpt

index 8d4c9d97f49dd0d360da9220103c97870a623475..835abd66c8a166c973610a9b9027fce903150148 100755 (executable)
 typedef struct {
        zend_object     zo;
 
-       // ICU collator
-       UCollator*      ucoll;
-
        // error handling
        intl_error  err;
 
+       // ICU collator
+       UCollator*      ucoll;
 } Collator_object;
 
 #define COLLATOR_ERROR(co) (co)->err
index 6fbb3da8b37983013f99ff714c6e4fbbb4871e43..404887b383a583420146df3a99eb9e42b5dc58a0 100755 (executable)
 #include "collator_create.h"
 #include "intl_data.h"
 
-/* {{{ proto Collator collator_create( string $locale )
- * Create collator.
- */
-PHP_FUNCTION( collator_create )
+/* {{{ */
+static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
 {
        char*            locale;
        int              locale_len = 0;
@@ -35,44 +33,37 @@ PHP_FUNCTION( collator_create )
        Collator_object* co;
 
        intl_error_reset( NULL TSRMLS_CC );
-
+       object = return_value;
        // Parse parameters.
        if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
                &locale, &locale_len ) == FAILURE )
        {
                intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                        "collator_create: unable to parse input params", 0 TSRMLS_CC );
-
+               zval_dtor(return_value);
                RETURN_NULL();
        }
 
        INTL_CHECK_LOCALE_LEN(locale_len);
-       // Create a Collator object and save the ICU collator into it.
-       if( ( object = getThis() ) == NULL )
-               object = return_value;
-
-       if( Z_TYPE_P( object ) != IS_OBJECT )
-               object_init_ex( object, Collator_ce_ptr );
-
        co = (Collator_object *) zend_object_store_get_object( object TSRMLS_CC );
 
-       intl_error_reset( COLLATOR_ERROR_P( co ) TSRMLS_CC );
-
        if(locale_len == 0) {
                locale = INTL_G(default_locale);
        }
 
        // Open ICU collator.
        co->ucoll = ucol_open( locale, COLLATOR_ERROR_CODE_P( co ) );
+       INTL_CTOR_CHECK_STATUS(co, "collator_create: unable to open ICU collator");
+}
+/* }}} */ 
 
-       if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) || co->ucoll == NULL )
-       {
-               intl_error_set( NULL, COLLATOR_ERROR_CODE( co ),
-                       "collator_create: unable to open ICU collator", 0 TSRMLS_CC );
-
-               // Collator creation failed.
-               RETURN_NULL();
-       }
+/* {{{ proto Collator collator_create( string $locale )
+ * Create collator.
+ */
+PHP_FUNCTION( collator_create )
+{
+       object_init_ex( return_value, Collator_ce_ptr );
+       collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
@@ -81,47 +72,8 @@ PHP_FUNCTION( collator_create )
  */
 PHP_METHOD( Collator, __construct )
 {
-       char* locale     = NULL;
-       int   locale_len = 0;
-
-       COLLATOR_METHOD_INIT_VARS
-
-       object = getThis();
-       // Parse parameters.
-       if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s",
-               &locale, &locale_len ) == FAILURE )
-       {
-               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                       "__construct: unable to parse input params", 0 TSRMLS_CC );
-
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
-       INTL_CHECK_LOCALE_LEN_OBJ(locale_len, object);
-       /* Fetch the object. */
-       co  = (Collator_object*) zend_object_store_get_object( object TSRMLS_CC );
-
-       intl_error_reset( COLLATOR_ERROR_P( co ) TSRMLS_CC );
-
-       if(locale_len == 0) {
-               locale = INTL_G(default_locale);
-       }
-
-       // Open ICU collator.
-       co->ucoll = ucol_open( locale, COLLATOR_ERROR_CODE_P( co ) );
-
-       if( U_FAILURE( COLLATOR_ERROR_CODE( co ) ) || co->ucoll == NULL )
-       {
-               intl_error_set( NULL, COLLATOR_ERROR_CODE( co ),
-                       "__construct: unable to open ICU collator", 0 TSRMLS_CC );
-
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
+       return_value = getThis();
+       collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
index b61d268d72c07465005a4cfe6e15311f4ac0ae9d..055066a1b91b84e0009c9472b231adb4c22a6992 100755 (executable)
@@ -67,242 +67,109 @@ void dateformat_register_constants( INIT_FUNC_ARGS )
 }
 /* }}} */
 
-/* {{{ proto IntlDateFormatter IntlDateFormatter::create( string $locale , long date_type, long time_type[,string $timezone_str, long $calendar , string $pattern] )
- * Create formatter. }}} */
-/* {{{ proto IntlDateFormatter datefmt_create( string $locale, long date_type, long time_type[,string $timezone_str, long $calendar , string $pattern] )
- * Create formatter.
- */
-PHP_FUNCTION( datefmt_create )
+/* {{{ */
+static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
 {
-       char*       locale;
+    char*       locale;
        int         locale_len = 0;
        zval*       object;
-
-        long         date_type = 0;
-        long         time_type = 0;
-        long         calendar = 1;
-        int         all_done = 0;
-        //zval*       timezone = NULL;
-
-        char*       timezone_str = NULL;
-        int         timezone_str_len = 0;
-        char*       pattern_str = NULL;
-        int         pattern_str_len = 0;
-        UChar*      svalue = NULL;             //UTF-16 pattern_str
-        int         slength = 0;
-        UChar*      timezone_utf16 = NULL;             //UTF-16 timezone_str
-        int         timezone_utf16_len = 0;
+    long        date_type = 0;
+    long        time_type = 0;
+    long        calendar = 1;
+    char*       timezone_str = NULL;
+    int         timezone_str_len = 0;
+    char*       pattern_str = NULL;
+    int         pattern_str_len = 0;
+    UChar*      svalue = NULL;         //UTF-16 pattern_str
+    int         slength = 0;
+    UChar*      timezone_utf16 = NULL;         //UTF-16 timezone_str
+    int         timezone_utf16_len = 0;
        UCalendar   ucal_obj = NULL;
+       IntlDateFormatter_object* dfo;
        
-
-       IntlDateFormatter_object* mfo;
-
        intl_error_reset( NULL TSRMLS_CC );
-
+       object = return_value;
        // Parse parameters.
-        if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sll|sls",
-                &locale, &locale_len, &date_type, & time_type , &timezone_str, &timezone_str_len , &calendar ,&pattern_str , &pattern_str_len ) == FAILURE )
-        {
-                intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                        "datefmt_create: unable to parse input params", 0 TSRMLS_CC );
-                RETURN_NULL();
-        }
-
-
-       // Create a IntlDateFormatter object and save the ICU formatter into it.
-       if( ( object = getThis() ) == NULL )
-               object = return_value;
-
-       if( Z_TYPE_P( object ) != IS_OBJECT )
-               object_init_ex( object, IntlDateFormatter_ce_ptr );
+    if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sll|sls",
+               &locale, &locale_len, &date_type, & time_type , &timezone_str, &timezone_str_len , &calendar ,&pattern_str , &pattern_str_len ) == FAILURE )
+    {
+               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: unable to parse input parameters", 0 TSRMLS_CC );
+               zval_dtor(return_value);
+               RETURN_NULL();
+    }
 
        DATE_FORMAT_METHOD_FETCH_OBJECT;
-
-       if(locale_len == 0) {
-               locale = INTL_G(default_locale);
-       }
-
        // Convert pattern (if specified) to UTF-16.
        if( pattern_str && pattern_str_len>0 ){
-               intl_convert_utf8_to_utf16(&svalue, &slength, pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(mfo));
-               INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" );
+               intl_convert_utf8_to_utf16(&svalue, &slength, pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(dfo));
+               INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: error converting pattern to UTF-16");
        }
 
        // Convert pattern (if specified) to UTF-16.
        if( timezone_str && timezone_str_len >0 ){
-               intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(mfo));
-               INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone_str to UTF-16" );
+               intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(dfo));
+               INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: error converting timezone_str to UTF-16" );
        }
 
-        // Create an ICU date formatter.
-        while(  U_FAILURE( INTL_DATA_ERROR_CODE(mfo)) || (all_done==0) ){
-               // Convert pattern (if specified) to UTF-16.
-               if( pattern_str && pattern_str_len>0 ){
-                       DATE_FORMAT_OBJECT(mfo) = udat_open(UDAT_IGNORE,UDAT_IGNORE, locale, timezone_utf16, timezone_utf16_len ,svalue ,slength , &INTL_DATA_ERROR_CODE((mfo)));
-               }else{
-                       DATE_FORMAT_OBJECT(mfo) = udat_open(time_type,date_type, locale, timezone_utf16, timezone_utf16_len ,svalue ,slength , &INTL_DATA_ERROR_CODE((mfo)));
-               }
-
-                //Set the calendar if passed
-                if( calendar) {
-                        ucal_obj = ucal_open( timezone_utf16 , timezone_utf16_len , locale , calendar , &INTL_DATA_ERROR_CODE(mfo) );
-                        udat_setCalendar( DATE_FORMAT_OBJECT(mfo), ucal_obj );
-                }
-                all_done = 1;
-
-        }//end of while
+       if(locale_len == 0) {
+               locale = INTL_G(default_locale);
+       }
 
+       if( pattern_str && pattern_str_len>0 ){
+               DATE_FORMAT_OBJECT(dfo) = udat_open(UDAT_IGNORE,UDAT_IGNORE, locale, timezone_utf16, timezone_utf16_len ,svalue ,slength , &INTL_DATA_ERROR_CODE(dfo));
+       } else {
+               DATE_FORMAT_OBJECT(dfo) = udat_open(time_type,date_type, locale, timezone_utf16, timezone_utf16_len ,svalue ,slength , &INTL_DATA_ERROR_CODE(dfo));
+       }
 
-        if( U_FAILURE( INTL_DATA_ERROR_CODE((mfo)) ) )
-        {
-                intl_error_set( NULL, INTL_DATA_ERROR_CODE((mfo)) ,
-                        "__construct: date formatter creation failed", 0 TSRMLS_CC );
-                zval_dtor(object);
-                ZVAL_NULL(object);
-               if( svalue){
-                       efree(svalue);
+    //Set the calendar if passed
+    if(!U_FAILURE(INTL_DATA_ERROR_CODE(dfo)) && calendar) {
+               ucal_obj = ucal_open( timezone_utf16 , timezone_utf16_len , locale , calendar , &INTL_DATA_ERROR_CODE(dfo) );
+               if(!U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
+                       udat_setCalendar( DATE_FORMAT_OBJECT(dfo), ucal_obj );
                }
-               if( timezone_utf16){
-                       efree(timezone_utf16);
-               }
-                RETURN_NULL();
-        }
+    }
 
-       if( svalue){
+       if(svalue)
+       {
                efree(svalue);
        }
-       if( timezone_utf16){
+       if(timezone_utf16)
+       {
                efree(timezone_utf16);
        }
+
+       INTL_CTOR_CHECK_STATUS(dfo, "datefmt_create: date formatter creation failed");
+
        //Set the class variables 
-       mfo->date_type   = date_type;
-       mfo->time_type   = time_type;
-       mfo->calendar   = calendar;
+       dfo->date_type = date_type;
+       dfo->time_type = time_type;
+       dfo->calendar  = calendar;
        if( timezone_str && timezone_str_len > 0){
-               if( mfo->timezone_id ){
-                       efree(mfo->timezone_id);
-               }
-               mfo->timezone_id = estrndup( timezone_str, timezone_str_len);
+               dfo->timezone_id = estrndup( timezone_str, timezone_str_len);
        }
 }
 /* }}} */
 
-/* {{{ proto void IntlDateFormatter::__construct( string $locale, string $pattern )
+/* {{{ proto IntlDateFormatter IntlDateFormatter::create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] )
+ * Create formatter. }}} */
+/* {{{ proto IntlDateFormatter datefmt_create(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern] )
+ * Create formatter.
+ */
+PHP_FUNCTION( datefmt_create )
+{
+    object_init_ex( return_value, IntlDateFormatter_ce_ptr );
+       datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+}
+/* }}} */
+
+/* {{{ proto void IntlDateFormatter::__construct(string $locale, long date_type, long time_type[, string $timezone_str, long $calendar, string $pattern])
  * IntlDateFormatter object constructor.
  */
 PHP_METHOD( IntlDateFormatter, __construct )
 {
-       char*       locale = NULL;
-       int         locale_len = 0;
-       long        date_type = 0;
-       long        time_type = 0;
-       long        calendar = 1;
-
-       char*       timezone_str = NULL;
-       int         timezone_str_len = 0;
-       char*       pattern_str = NULL;
-       int         pattern_str_len = 0;
-       UChar*      svalue = NULL;
-       int         slength = 0;
-        UChar*      timezone_utf16 = NULL;             //UTF-16 timezone_str
-        int         timezone_utf16_len = 0;
-
-       UCalendar   ucal_obj = NULL;
-       int         all_done = 0; 
-
-       zval*       object;
-       IntlDateFormatter_object* mfo;
-
-       intl_error_reset( NULL TSRMLS_CC );
-
-       object = getThis();
-
-       // Parse parameters.
-        if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sll|slsb",
-               &locale, &locale_len, &date_type, & time_type , &timezone_str, &timezone_str_len , &calendar ,&pattern_str , &pattern_str_len  ) == FAILURE )
-       {
-               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                       "__construct: unable to parse input params", 0 TSRMLS_CC );
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
-/*
-       //Check if timezone is in proper type
-       if( (Z_TYPE_P(timezone) != IS_STRING) && (Z_TYPE_P(timezone) != IS_OBJECT) ){
-               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                        "__construct: unable to parse input params", 0 TSRMLS_CC );
-                zval_dtor(object);
-                ZVAL_NULL(object);
-                RETURN_NULL();
-       }
-*/
-
-       mfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
-
-       intl_error_reset( &mfo->datef_data.error TSRMLS_CC );
-
-       if(locale_len == 0) {
-               locale = INTL_G(default_locale);
-       }
-
-       // Convert pattern (if specified) to UTF-16.
-       if( pattern_str && pattern_str_len>0 ){
-               intl_convert_utf8_to_utf16(&svalue, &slength, pattern_str, pattern_str_len, &INTL_DATA_ERROR_CODE(mfo));
-               INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" );
-       }
-
-       // Convert pattern (if specified) to UTF-16.
-       if( timezone_str && timezone_str_len >0 ){
-               intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_str, timezone_str_len, &INTL_DATA_ERROR_CODE(mfo));
-               INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone_str to UTF-16" );
-       }
-
-
-        // Create an ICU date formatter.
-        while(  U_FAILURE( INTL_DATA_ERROR_CODE(mfo)) || (all_done==0) ){
-               if( pattern_str && pattern_str_len>0 ){
-                       DATE_FORMAT_OBJECT(mfo) = udat_open(UDAT_IGNORE,UDAT_IGNORE, locale, timezone_utf16, timezone_utf16_len ,svalue ,slength , &INTL_DATA_ERROR_CODE((mfo)));
-               }else{
-                       DATE_FORMAT_OBJECT(mfo) = udat_open(time_type,date_type, locale, timezone_utf16, timezone_utf16_len ,svalue ,slength , &INTL_DATA_ERROR_CODE((mfo)));
-               }
-
-
-                //Set the calendar if passed
-                if( calendar) {
-                        ucal_obj = ucal_open( timezone_utf16 , timezone_utf16_len , locale , calendar , &INTL_DATA_ERROR_CODE(mfo) );
-                        udat_setCalendar( DATE_FORMAT_OBJECT(mfo), ucal_obj );
-                }
-                all_done = 1;
-
-        }//end of while
-
-
-       if( U_FAILURE( INTL_DATA_ERROR_CODE((mfo)) ) )
-       {
-               intl_error_set( NULL, INTL_DATA_ERROR_CODE(mfo),
-                       "__construct: date formatter creation failed", 0 TSRMLS_CC );
-               if( svalue){
-                       efree(svalue);
-               }
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
-       if( svalue){
-               efree(svalue);
-       }
-
-       //Set the class variables 
-       mfo->date_type   = date_type;
-       mfo->time_type   = time_type;
-       mfo->calendar   = calendar;
-       if( timezone_str && timezone_str_len > 0){
-               mfo->timezone_id = estrndup( timezone_str, timezone_str_len);
-       }
+       return_value = getThis();
+       datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
@@ -314,7 +181,7 @@ PHP_METHOD( IntlDateFormatter, __construct )
 PHP_FUNCTION( datefmt_get_error_code )
 {
        zval*                    object  = NULL;
-       IntlDateFormatter_object*  mfo     = NULL;
+       IntlDateFormatter_object*  dfo     = NULL;
 
        // Parse parameters.
        if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
@@ -322,14 +189,13 @@ PHP_FUNCTION( datefmt_get_error_code )
        {
                intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                        "datefmt_get_error_code: unable to parse input params", 0 TSRMLS_CC );
-
                RETURN_FALSE;
        }
 
-       mfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
+       dfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
 
        // Return formatter's last error code.
-       RETURN_LONG( INTL_DATA_ERROR_CODE(mfo) );
+       RETURN_LONG( INTL_DATA_ERROR_CODE(dfo) );
 }
 /* }}} */
 
@@ -342,7 +208,7 @@ PHP_FUNCTION( datefmt_get_error_message )
 {
        char*                    message = NULL;
        zval*                    object  = NULL;
-       IntlDateFormatter_object*  mfo     = NULL;
+       IntlDateFormatter_object*  dfo     = NULL;
 
        // Parse parameters.
        if( zend_parse_method_parameters( ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",
@@ -354,10 +220,10 @@ PHP_FUNCTION( datefmt_get_error_message )
                RETURN_FALSE;
        }
 
-       mfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
+       dfo = (IntlDateFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
 
        // Return last error message.
-       message = intl_error_get_message( &mfo->datef_data.error TSRMLS_CC );
+       message = intl_error_get_message( &dfo->datef_data.error TSRMLS_CC );
        RETURN_STRING( message, 0);
 }
 /* }}} */
index 09997b6ee39ef298d058bb8531de03476f9838b0..a912b26ae7032617346389b0cbb34e8b612ab359 100755 (executable)
@@ -26,7 +26,7 @@
 #include <unicode/udat.h>
 #include <unicode/ucal.h>
 
-static void internal_set_calendar(IntlDateFormatter_object *mfo, char* timezone_id , int timezone_id_len , int calendar  ,zval* return_value TSRMLS_DC){
+static void internal_set_calendar(IntlDateFormatter_object *dfo, char* timezone_id , int timezone_id_len , int calendar  ,zval* return_value TSRMLS_DC){
 
         int         timezone_utf16_len = 0;
         UChar*      timezone_utf16  = NULL;             //timezone_id in UTF-16
@@ -45,17 +45,17 @@ static void internal_set_calendar(IntlDateFormatter_object *mfo, char* timezone_
         }
 
         // Convert timezone to UTF-16.
-        intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_id, timezone_id_len  , &INTL_DATA_ERROR_CODE(mfo));
-        INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone to UTF-16" );
+        intl_convert_utf8_to_utf16(&timezone_utf16, &timezone_utf16_len, timezone_id, timezone_id_len  , &INTL_DATA_ERROR_CODE(dfo));
+        INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" );
 
 
         //Get the lcoale for the dateformatter
-        locale = (char *)udat_getLocaleByType(DATE_FORMAT_OBJECT(mfo), locale_type ,&INTL_DATA_ERROR_CODE(mfo));
+        locale = (char *)udat_getLocaleByType(DATE_FORMAT_OBJECT(dfo), locale_type ,&INTL_DATA_ERROR_CODE(dfo));
 
         //Set the calendar if passed
-        ucal_obj = ucal_open( timezone_utf16 , timezone_utf16_len , locale , calendar , &INTL_DATA_ERROR_CODE(mfo) );
-        udat_setCalendar( DATE_FORMAT_OBJECT(mfo), ucal_obj );
-        INTL_METHOD_CHECK_STATUS(mfo, "Error setting the calendar.");
+        ucal_obj = ucal_open( timezone_utf16 , timezone_utf16_len , locale , calendar , &INTL_DATA_ERROR_CODE(dfo) );
+        udat_setCalendar( DATE_FORMAT_OBJECT(dfo), ucal_obj );
+        INTL_METHOD_CHECK_STATUS(dfo, "Error setting the calendar.");
 
         if( timezone_utf16){
                 efree(timezone_utf16);
@@ -83,9 +83,9 @@ PHP_FUNCTION( datefmt_get_datetype )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       INTL_METHOD_CHECK_STATUS(mfo, "Error getting formatter datetype." );
+       INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter datetype." );
 
-       RETURN_LONG(mfo->date_type );
+       RETURN_LONG(dfo->date_type );
 }
 /* }}} */
 
@@ -109,9 +109,9 @@ PHP_FUNCTION( datefmt_get_timetype )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       INTL_METHOD_CHECK_STATUS(mfo, "Error getting formatter timetype." );
+       INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timetype." );
 
-       RETURN_LONG(mfo->time_type );
+       RETURN_LONG(dfo->time_type );
 }
 /* }}} */
 
@@ -136,9 +136,9 @@ PHP_FUNCTION( datefmt_get_calendar )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       INTL_METHOD_CHECK_STATUS(mfo, "Error getting formatter calendar." );
+       INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter calendar." );
 
-       RETURN_LONG(mfo->calendar );
+       RETURN_LONG(dfo->calendar );
 }
 /* }}} */
 
@@ -162,10 +162,10 @@ PHP_FUNCTION( datefmt_get_timezone_id )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       INTL_METHOD_CHECK_STATUS(mfo, "Error getting formatter timezone_id." );
+       INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter timezone_id." );
 
-       if( mfo->timezone_id ){
-               RETURN_STRING((char*)mfo->timezone_id ,TRUE );
+       if( dfo->timezone_id ){
+               RETURN_STRING((char*)dfo->timezone_id ,TRUE );
        }else{
                RETURN_NULL();
        }
@@ -195,13 +195,13 @@ PHP_FUNCTION( datefmt_set_timezone_id )
         DATE_FORMAT_METHOD_FETCH_OBJECT;
 
        //set the timezone for the calendar
-       internal_set_calendar( mfo , timezone_id , timezone_id_len , mfo->calendar ,return_value TSRMLS_CC );
+       internal_set_calendar( dfo , timezone_id , timezone_id_len , dfo->calendar ,return_value TSRMLS_CC );
 
        //Set the IntlDateFormatter variable
-        if( mfo->timezone_id ){
-               efree(mfo->timezone_id);
+        if( dfo->timezone_id ){
+               efree(dfo->timezone_id);
        }
-       mfo->timezone_id = estrndup(timezone_id , timezone_id_len);
+       dfo->timezone_id = estrndup(timezone_id , timezone_id_len);
 
        RETURN_TRUE;
 }
@@ -231,20 +231,20 @@ PHP_FUNCTION( datefmt_get_pattern )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       length = udat_toPattern(DATE_FORMAT_OBJECT(mfo), is_pattern_localized, value, length, &INTL_DATA_ERROR_CODE(mfo));
-       if(INTL_DATA_ERROR_CODE(mfo) == U_BUFFER_OVERFLOW_ERROR && length >= USIZE( value_buf )) {
+       length = udat_toPattern(DATE_FORMAT_OBJECT(dfo), is_pattern_localized, value, length, &INTL_DATA_ERROR_CODE(dfo));
+       if(INTL_DATA_ERROR_CODE(dfo) == U_BUFFER_OVERFLOW_ERROR && length >= USIZE( value_buf )) {
                ++length; // to avoid U_STRING_NOT_TERMINATED_WARNING
-               INTL_DATA_ERROR_CODE(mfo) = U_ZERO_ERROR;
+               INTL_DATA_ERROR_CODE(dfo) = U_ZERO_ERROR;
                value = eumalloc(length);
-               length = udat_toPattern(DATE_FORMAT_OBJECT(mfo), is_pattern_localized , value, length, &INTL_DATA_ERROR_CODE(mfo) );
-               if(U_FAILURE(INTL_DATA_ERROR_CODE(mfo))) {
+               length = udat_toPattern(DATE_FORMAT_OBJECT(dfo), is_pattern_localized , value, length, &INTL_DATA_ERROR_CODE(dfo) );
+               if(U_FAILURE(INTL_DATA_ERROR_CODE(dfo))) {
                        efree(value);
                        value = value_buf;
                }
        }
-       INTL_METHOD_CHECK_STATUS(mfo, "Error getting formatter pattern" );
+       INTL_METHOD_CHECK_STATUS(dfo, "Error getting formatter pattern" );
 
-       INTL_METHOD_RETVAL_UTF8( mfo, value, length, ( value != value_buf ) );
+       INTL_METHOD_RETVAL_UTF8( dfo, value, length, ( value != value_buf ) );
 }
 /* }}} */
 
@@ -276,13 +276,13 @@ PHP_FUNCTION( datefmt_set_pattern )
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
        // Convert given pattern to UTF-16.
-       intl_convert_utf8_to_utf16(&svalue, &slength, value, value_len, &INTL_DATA_ERROR_CODE(mfo));
-       INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" );
+       intl_convert_utf8_to_utf16(&svalue, &slength, value, value_len, &INTL_DATA_ERROR_CODE(dfo));
+       INTL_METHOD_CHECK_STATUS(dfo, "Error converting pattern to UTF-16" );
 
-       udat_applyPattern(DATE_FORMAT_OBJECT(mfo), (UBool)is_pattern_localized , svalue, slength);
+       udat_applyPattern(DATE_FORMAT_OBJECT(dfo), (UBool)is_pattern_localized , svalue, slength);
 
        efree(svalue);
-       INTL_METHOD_CHECK_STATUS(mfo, "Error setting symbol value");
+       INTL_METHOD_CHECK_STATUS(dfo, "Error setting symbol value");
 
        RETURN_TRUE;
 }
@@ -313,7 +313,7 @@ PHP_FUNCTION( datefmt_get_locale )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       loc = (char *)udat_getLocaleByType(DATE_FORMAT_OBJECT(mfo), loc_type ,&INTL_DATA_ERROR_CODE(mfo));
+       loc = (char *)udat_getLocaleByType(DATE_FORMAT_OBJECT(dfo), loc_type ,&INTL_DATA_ERROR_CODE(dfo));
        RETURN_STRING(loc, 1);
 }
 /* }}} */
@@ -341,7 +341,7 @@ PHP_FUNCTION( datefmt_is_lenient )
        // Fetch the object.
        DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       RETVAL_BOOL(udat_isLenient(DATE_FORMAT_OBJECT(mfo)));
+       RETVAL_BOOL(udat_isLenient(DATE_FORMAT_OBJECT(dfo)));
 }
 /* }}} */
 
@@ -370,7 +370,7 @@ PHP_FUNCTION( datefmt_set_lenient )
         // Fetch the object.
         DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-        udat_setLenient(DATE_FORMAT_OBJECT(mfo) , (UBool)isLenient );
+        udat_setLenient(DATE_FORMAT_OBJECT(dfo) , (UBool)isLenient );
 }
 /* }}} */
 
@@ -404,10 +404,10 @@ PHP_FUNCTION( datefmt_set_calendar )
 
         DATE_FORMAT_METHOD_FETCH_OBJECT;
 
-       internal_set_calendar( mfo , mfo->timezone_id , strlen(mfo->timezone_id) , calendar ,return_value TSRMLS_CC );
+       internal_set_calendar( dfo , dfo->timezone_id , strlen(dfo->timezone_id) , calendar ,return_value TSRMLS_CC );
 
        //Set the calendar  value in the IntlDateFormatter object
-        mfo->calendar = calendar ;
+        dfo->calendar = calendar ;
 
         RETURN_TRUE;
 }
index 7a8611b9b74a7ca1d37b56e94eb24d611a6d65f9..d97723b6159b34a8f80a0d90f2b9f1fadee18d76 100755 (executable)
@@ -39,17 +39,17 @@ static void IntlDateFormatter_object_dtor(void *object, zend_object_handle handl
 /* {{{ IntlDateFormatter_objects_free */
 void IntlDateFormatter_object_free( zend_object *object TSRMLS_DC )
 {
-       IntlDateFormatter_object* mfo = (IntlDateFormatter_object*)object;
+       IntlDateFormatter_object* dfo = (IntlDateFormatter_object*)object;
 
-       zend_object_std_dtor( &mfo->zo TSRMLS_CC );
+       zend_object_std_dtor( &dfo->zo TSRMLS_CC );
 
-       dateformat_data_free( &mfo->datef_data TSRMLS_CC );
+       dateformat_data_free( &dfo->datef_data TSRMLS_CC );
        
-       if( mfo->timezone_id ){
-               efree(mfo->timezone_id);
+       if( dfo->timezone_id ){
+               efree(dfo->timezone_id);
        }
 
-       efree( mfo );
+       efree( dfo );
 }
 /* }}} */
 
index 039ff1a59ac19945db1b7665dcae62df3216d21f..9ad83ee3d63c94476a5e2e5b90ccb8a4a3f2aa73 100755 (executable)
@@ -37,8 +37,8 @@ extern zend_class_entry *IntlDateFormatter_ce_ptr;
 
 /* Auxiliary macros */
 
-#define DATE_FORMAT_METHOD_INIT_VARS   INTL_METHOD_INIT_VARS(IntlDateFormatter, mfo)
-#define DATE_FORMAT_METHOD_FETCH_OBJECT        INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, mfo)
-#define DATE_FORMAT_OBJECT(mfo)                (mfo)->datef_data.udatf
+#define DATE_FORMAT_METHOD_INIT_VARS   INTL_METHOD_INIT_VARS(IntlDateFormatter, dfo)
+#define DATE_FORMAT_METHOD_FETCH_OBJECT        INTL_METHOD_FETCH_OBJECT(IntlDateFormatter, dfo)
+#define DATE_FORMAT_OBJECT(dfo)                (dfo)->datef_data.udatf
 
 #endif // #ifndef DATE_FORMAT_CLASS_H
index c23ab3203dbfaf76ae3bd03d594be05e086be308..bf575c98839099455918cf3d495b62cca1cdef26 100755 (executable)
 /* {{{ 
  * Internal function which calls the udat_format
 */
-static void internal_format(IntlDateFormatter_object *mfo, UDate timestamp , zval *return_value TSRMLS_DC){
+static void internal_format(IntlDateFormatter_object *dfo, UDate timestamp , zval *return_value TSRMLS_DC){
        UChar*  formatted =  NULL;
        int32_t resultlengthneeded =0 ;
        
-       resultlengthneeded=udat_format( DATE_FORMAT_OBJECT(mfo), timestamp, NULL, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(mfo));
-       if(INTL_DATA_ERROR_CODE(mfo)==U_BUFFER_OVERFLOW_ERROR)
+       resultlengthneeded=udat_format( DATE_FORMAT_OBJECT(dfo), timestamp, NULL, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(dfo));
+       if(INTL_DATA_ERROR_CODE(dfo)==U_BUFFER_OVERFLOW_ERROR)
        {
-               INTL_DATA_ERROR_CODE(mfo)=U_ZERO_ERROR;
+               INTL_DATA_ERROR_CODE(dfo)=U_ZERO_ERROR;
                formatted=(UChar*)emalloc(sizeof(UChar) * resultlengthneeded); 
-               udat_format( DATE_FORMAT_OBJECT(mfo), timestamp, formatted, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(mfo));
+               udat_format( DATE_FORMAT_OBJECT(dfo), timestamp, formatted, resultlengthneeded, NULL, &INTL_DATA_ERROR_CODE(dfo));
        }
 
-       if (formatted && U_FAILURE( INTL_DATA_ERROR_CODE(mfo) ) ) {
+       if (formatted && U_FAILURE( INTL_DATA_ERROR_CODE(dfo) ) ) {
                        efree(formatted);
        }
 
-       INTL_METHOD_CHECK_STATUS( mfo, "Date formatting failed" );
-       INTL_METHOD_RETVAL_UTF8( mfo, formatted, resultlengthneeded, 1 );
+       INTL_METHOD_CHECK_STATUS( dfo, "Date formatting failed" );
+       INTL_METHOD_RETVAL_UTF8( dfo, formatted, resultlengthneeded, 1 );
 
 }
 /* }}} */
@@ -57,7 +57,7 @@ static void internal_format(IntlDateFormatter_object *mfo, UDate timestamp , zva
 /* {{{ 
  * Internal function which fetches an element from the passed array for the key_name passed 
 */
-static double internal_get_arr_ele(IntlDateFormatter_object *mfo  , HashTable* hash_arr  ,char* key_name TSRMLS_DC){
+static double internal_get_arr_ele(IntlDateFormatter_object *dfo  , HashTable* hash_arr  ,char* key_name TSRMLS_DC){
        zval**  ele_value       = NULL;
        UDate result = -1;
 
@@ -77,7 +77,7 @@ static double internal_get_arr_ele(IntlDateFormatter_object *mfo  , HashTable* h
 /* {{{ 
  * Internal function which creates a UCalendar  from the passed array
 */
-static void internal_create_ucal(IntlDateFormatter_object *mfo, HashTable* hash_arr , UCalendar* pcal  TSRMLS_DC){
+static void internal_create_ucal(IntlDateFormatter_object *dfo, HashTable* hash_arr , UCalendar* pcal  TSRMLS_DC){
        long year =0;
        long month =0;
        long hour =0;
@@ -89,21 +89,21 @@ static void internal_create_ucal(IntlDateFormatter_object *mfo, HashTable* hash_
        UBool isInDST = FALSE;
 
        //Fetch  values from the incoming array
-       year = internal_get_arr_ele( mfo , hash_arr , CALENDAR_YEAR TSRMLS_CC) + 1900; //tm_year is years since 1900
+       year = internal_get_arr_ele( dfo , hash_arr , CALENDAR_YEAR TSRMLS_CC) + 1900; //tm_year is years since 1900
        //Month in ICU and PHP starts from January =0
-       month = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MON TSRMLS_CC);
-       hour = internal_get_arr_ele( mfo , hash_arr , CALENDAR_HOUR TSRMLS_CC);
-       minute = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MIN TSRMLS_CC);
-       second = internal_get_arr_ele( mfo , hash_arr , CALENDAR_SEC TSRMLS_CC);
-       wday = internal_get_arr_ele( mfo , hash_arr , CALENDAR_WDAY TSRMLS_CC);
-       yday = internal_get_arr_ele( mfo , hash_arr , CALENDAR_YDAY TSRMLS_CC);
-       isInDST = internal_get_arr_ele( mfo , hash_arr , CALENDAR_ISDST TSRMLS_CC);
+       month = internal_get_arr_ele( dfo , hash_arr , CALENDAR_MON TSRMLS_CC);
+       hour = internal_get_arr_ele( dfo , hash_arr , CALENDAR_HOUR TSRMLS_CC);
+       minute = internal_get_arr_ele( dfo , hash_arr , CALENDAR_MIN TSRMLS_CC);
+       second = internal_get_arr_ele( dfo , hash_arr , CALENDAR_SEC TSRMLS_CC);
+       wday = internal_get_arr_ele( dfo , hash_arr , CALENDAR_WDAY TSRMLS_CC);
+       yday = internal_get_arr_ele( dfo , hash_arr , CALENDAR_YDAY TSRMLS_CC);
+       isInDST = internal_get_arr_ele( dfo , hash_arr , CALENDAR_ISDST TSRMLS_CC);
        //For the ucal_setDateTime() function , this is the 'date'  value
-       mday = internal_get_arr_ele( mfo , hash_arr , CALENDAR_MDAY TSRMLS_CC);
+       mday = internal_get_arr_ele( dfo , hash_arr , CALENDAR_MDAY TSRMLS_CC);
 
        //set the incoming values for the calendar      
-       ucal_setDateTime( pcal, year, month  , mday , hour , minute , second , &INTL_DATA_ERROR_CODE(mfo));
-       if( INTL_DATA_ERROR_CODE(mfo) != U_ZERO_ERROR){
+       ucal_setDateTime( pcal, year, month  , mday , hour , minute , second , &INTL_DATA_ERROR_CODE(dfo));
+       if( INTL_DATA_ERROR_CODE(dfo) != U_ZERO_ERROR){
                return;
        }
        //ICU UCAL_DAY_OF_WEEK starts from SUNDAY=1  thru SATURDAY=7 
@@ -157,14 +157,14 @@ PHP_FUNCTION(datefmt_format)
                        if( !hash_arr || zend_hash_num_elements( hash_arr ) == 0 )
                                RETURN_FALSE;
                        //Create a UCalendar object from the array and then format it
-                       temp_cal = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &INTL_DATA_ERROR_CODE(mfo));
+                       temp_cal = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &INTL_DATA_ERROR_CODE(dfo));
                        ucal_clear(temp_cal);
-                       INTL_METHOD_CHECK_STATUS( mfo, "datefmt_format: Date formatting failed while creating calendar from the  array" )
-                       internal_create_ucal( mfo ,  hash_arr , temp_cal TSRMLS_CC);
-                       INTL_METHOD_CHECK_STATUS( mfo, "datefmt_format: Date formatting failed while creating calendar from the  array" )
+                       INTL_METHOD_CHECK_STATUS( dfo, "datefmt_format: Date formatting failed while creating calendar from the  array" )
+                       internal_create_ucal( dfo ,  hash_arr , temp_cal TSRMLS_CC);
+                       INTL_METHOD_CHECK_STATUS( dfo, "datefmt_format: Date formatting failed while creating calendar from the  array" )
                        //Fetch the timestamp from the  created UCalendar
-                       timestamp  = ucal_getMillis(temp_cal  , &INTL_DATA_ERROR_CODE(mfo) );
-                       INTL_METHOD_CHECK_STATUS( mfo, "datefmt_format: Date formatting failed" )
+                       timestamp  = ucal_getMillis(temp_cal  , &INTL_DATA_ERROR_CODE(dfo) );
+                       INTL_METHOD_CHECK_STATUS( dfo, "datefmt_format: Date formatting failed" )
                        break;
 /*
                case IS_OBJECT:
@@ -176,7 +176,7 @@ PHP_FUNCTION(datefmt_format)
                        RETURN_FALSE;
        }
 
-       internal_format( mfo, timestamp ,return_value TSRMLS_CC);
+       internal_format( dfo, timestamp ,return_value TSRMLS_CC);
        
 }
 
index 58394bb985d32ba0f1ebe29c723e3b4734d73462..881e244a2cec6ffeea0754e042579b40c8a94daa 100755 (executable)
  *     if set to 1 - store any error encountered  in the parameter parse_error  
  *     if set to 0 - no need to store any error encountered  in the parameter parse_error  
 */
-static void internal_parse_to_timestamp(IntlDateFormatter_object *mfo, char* text_to_parse , int32_t text_len, int32_t *parse_pos , zval *return_value TSRMLS_DC){
+static void internal_parse_to_timestamp(IntlDateFormatter_object *dfo, char* text_to_parse , int32_t text_len, int32_t *parse_pos , zval *return_value TSRMLS_DC){
        long    result =  0;
        UDate   timestamp   =0;
        UChar*  text_utf16  = NULL;
        int32_t text_utf16_len = 0;
 
        // Convert timezone to UTF-16.
-        intl_convert_utf8_to_utf16(&text_utf16 , &text_utf16_len , text_to_parse , text_len, &INTL_DATA_ERROR_CODE(mfo));
-        INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone to UTF-16" );
+        intl_convert_utf8_to_utf16(&text_utf16 , &text_utf16_len , text_to_parse , text_len, &INTL_DATA_ERROR_CODE(dfo));
+        INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" );
 
-       timestamp = udat_parse( DATE_FORMAT_OBJECT(mfo), text_utf16 , text_utf16_len , parse_pos , &INTL_DATA_ERROR_CODE(mfo));
+       timestamp = udat_parse( DATE_FORMAT_OBJECT(dfo), text_utf16 , text_utf16_len , parse_pos , &INTL_DATA_ERROR_CODE(dfo));
        if( text_utf16 ){
                efree(text_utf16);
        }
 
-       INTL_METHOD_CHECK_STATUS( mfo, "Date parsing failed" );
+       INTL_METHOD_CHECK_STATUS( dfo, "Date parsing failed" );
        
        //Since return is in  sec.
        result = (long )( timestamp / 1000 );
@@ -60,9 +60,9 @@ static void internal_parse_to_timestamp(IntlDateFormatter_object *mfo, char* tex
 }
 /* }}} */
 
-static void add_to_localtime_arr( IntlDateFormatter_object *mfo, zval* return_value ,UCalendar parsed_calendar , long calendar_field , char* key_name TSRMLS_DC){
-       long calendar_field_val = ucal_get( parsed_calendar , calendar_field , &INTL_DATA_ERROR_CODE(mfo));     
-       INTL_METHOD_CHECK_STATUS( mfo, "Date parsing - localtime failed : could not get a field from calendar" );
+static void add_to_localtime_arr( IntlDateFormatter_object *dfo, zval* return_value ,UCalendar parsed_calendar , long calendar_field , char* key_name TSRMLS_DC){
+       long calendar_field_val = ucal_get( parsed_calendar , calendar_field , &INTL_DATA_ERROR_CODE(dfo));     
+       INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : could not get a field from calendar" );
 
        if( strcmp(key_name , CALENDAR_YEAR )==0 ){
                //since tm_year is years from 1900
@@ -78,39 +78,39 @@ static void add_to_localtime_arr( IntlDateFormatter_object *mfo, zval* return_va
 /* {{{
  * Internal function which calls the udat_parseCalendar
 */
-static void internal_parse_to_localtime(IntlDateFormatter_object *mfo, char* text_to_parse , int32_t text_len, int32_t *parse_pos , zval *return_value TSRMLS_DC){
+static void internal_parse_to_localtime(IntlDateFormatter_object *dfo, char* text_to_parse , int32_t text_len, int32_t *parse_pos , zval *return_value TSRMLS_DC){
         UCalendar*     parsed_calendar = NULL ;
         UChar*         text_utf16  = NULL;
         int32_t        text_utf16_len = 0;
        long            isInDST = 0;
 
         // Convert timezone to UTF-16.
-        intl_convert_utf8_to_utf16(&text_utf16 , &text_utf16_len , text_to_parse , text_len, &INTL_DATA_ERROR_CODE(mfo));
-        INTL_METHOD_CHECK_STATUS(mfo, "Error converting timezone to UTF-16" );
+        intl_convert_utf8_to_utf16(&text_utf16 , &text_utf16_len , text_to_parse , text_len, &INTL_DATA_ERROR_CODE(dfo));
+        INTL_METHOD_CHECK_STATUS(dfo, "Error converting timezone to UTF-16" );
 
-       parsed_calendar = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &INTL_DATA_ERROR_CODE(mfo));
-        udat_parseCalendar( DATE_FORMAT_OBJECT(mfo), parsed_calendar , text_utf16 , text_utf16_len , parse_pos , &INTL_DATA_ERROR_CODE(mfo));
+       parsed_calendar = ucal_open(NULL, -1, NULL, UCAL_GREGORIAN, &INTL_DATA_ERROR_CODE(dfo));
+        udat_parseCalendar( DATE_FORMAT_OBJECT(dfo), parsed_calendar , text_utf16 , text_utf16_len , parse_pos , &INTL_DATA_ERROR_CODE(dfo));
         if( text_utf16 ){
                 efree(text_utf16);
         }
 
-        INTL_METHOD_CHECK_STATUS( mfo, "Date parsing failed" );
+        INTL_METHOD_CHECK_STATUS( dfo, "Date parsing failed" );
 
 
        array_init( return_value );
        //Add  entries from various fields of the obtained parsed_calendar
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_SECOND , CALENDAR_SEC TSRMLS_CC);
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_MINUTE , CALENDAR_MIN TSRMLS_CC);
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_HOUR_OF_DAY , CALENDAR_HOUR TSRMLS_CC);
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_YEAR , CALENDAR_YEAR TSRMLS_CC); 
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_MONTH , CALENDAR_MDAY TSRMLS_CC);
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_WEEK  , CALENDAR_WDAY TSRMLS_CC);
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_DAY_OF_YEAR  , CALENDAR_YDAY TSRMLS_CC);
-       add_to_localtime_arr( mfo , return_value , parsed_calendar , UCAL_MONTH , CALENDAR_MON TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_SECOND , CALENDAR_SEC TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_MINUTE , CALENDAR_MIN TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_HOUR_OF_DAY , CALENDAR_HOUR TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_YEAR , CALENDAR_YEAR TSRMLS_CC); 
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_DAY_OF_MONTH , CALENDAR_MDAY TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_DAY_OF_WEEK  , CALENDAR_WDAY TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_DAY_OF_YEAR  , CALENDAR_YDAY TSRMLS_CC);
+       add_to_localtime_arr( dfo , return_value , parsed_calendar , UCAL_MONTH , CALENDAR_MON TSRMLS_CC);
 
        //Is in DST?
-       isInDST = ucal_inDaylightTime(parsed_calendar    , &INTL_DATA_ERROR_CODE(mfo));
-        INTL_METHOD_CHECK_STATUS( mfo, "Date parsing - localtime failed : while checking if currently in DST." );
+       isInDST = ucal_inDaylightTime(parsed_calendar    , &INTL_DATA_ERROR_CODE(dfo));
+        INTL_METHOD_CHECK_STATUS( dfo, "Date parsing - localtime failed : while checking if currently in DST." );
        add_assoc_long( return_value, CALENDAR_ISDST ,(isInDST==1?1:0)); 
 }
 /* }}} */
@@ -148,7 +148,7 @@ PHP_FUNCTION(datefmt_parse)
                        RETURN_FALSE;
                }
        }
-       internal_parse_to_timestamp( mfo, text_to_parse,  text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC);
+       internal_parse_to_timestamp( dfo, text_to_parse,  text_len, z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC);
        if(z_parse_pos) {
                zval_dtor(z_parse_pos);
                ZVAL_LONG(z_parse_pos, parse_pos);
@@ -189,7 +189,7 @@ PHP_FUNCTION(datefmt_localtime)
                        RETURN_FALSE;
                }
        }
-       internal_parse_to_localtime( mfo, text_to_parse ,  text_len , z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC);
+       internal_parse_to_localtime( dfo, text_to_parse ,  text_len , z_parse_pos?&parse_pos:NULL, return_value TSRMLS_CC);
        if(z_parse_pos) {
                zval_dtor(z_parse_pos);
                ZVAL_LONG(z_parse_pos, parse_pos);
index e868d8f2e048e2a9a7d60434448e97cb1cad361d..85ea9d3157265712c004a41dd8e6df403ea97c49 100755 (executable)
 #include "formatter_class.h"
 #include "intl_convert.h"
 
-/* {{{ proto NumberFormatter NumberFormatter::create( string $locale, int style[, string $pattern ] )
- * Create formatter. }}} */
-/* {{{ proto NumberFormatter numfmt_create( string $locale, int style[, string $pattern ] )
- * Create formatter.
- */
-PHP_FUNCTION( numfmt_create )
+/* {{{ */
+static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
 {
        char*       locale;
        char*       pattern = NULL;
@@ -45,30 +41,18 @@ PHP_FUNCTION( numfmt_create )
        {
                intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                        "numfmt_create: unable to parse input parameters", 0 TSRMLS_CC );
-
+               zval_dtor(return_value);
                RETURN_NULL();
        }
 
        INTL_CHECK_LOCALE_LEN(locale_len);
-       // Create a NumberFormatter object and save the ICU formatter into it.
-       if( ( object = getThis() ) == NULL )
-               object = return_value;
-
-       if( Z_TYPE_P( object ) != IS_OBJECT )
-       object_init_ex( object, NumberFormatter_ce_ptr );
-
+       object = return_value;
        FORMATTER_METHOD_FETCH_OBJECT;
 
        // Convert pattern (if specified) to UTF-16.
        if(pattern && pattern_len) {
                intl_convert_utf8_to_utf16(&spattern, &spattern_len, pattern, pattern_len, &INTL_DATA_ERROR_CODE(nfo));
-               if( U_FAILURE( INTL_DATA_ERROR_CODE((nfo)) ) )
-               {
-                       intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                               "numfmt_create: error converting pattern to UTF-16", 0 TSRMLS_CC );
-                       zval_dtor(return_value);
-                       RETURN_NULL();
-               }
+               INTL_CTOR_CHECK_STATUS(nfo, "numfmt_create: error converting pattern to UTF-16");
        }
 
        if(locale_len == 0) {
@@ -82,13 +66,19 @@ PHP_FUNCTION( numfmt_create )
                efree(spattern);
        }
 
-       if( U_FAILURE( INTL_DATA_ERROR_CODE((nfo)) ) )
-       {
-               intl_error_set( NULL, INTL_DATA_ERROR_CODE( nfo ),
-                       "numfmt_create: number formatter creation failed", 0 TSRMLS_CC );
-               zval_dtor(return_value);
-               RETURN_NULL();
-       }
+       INTL_CTOR_CHECK_STATUS(nfo, "numfmt_create: number formatter creation failed");
+}
+/* }}} */
+
+/* {{{ proto NumberFormatter NumberFormatter::create( string $locale, int style[, string $pattern ] )
+ * Create number formatter. }}} */
+/* {{{ proto NumberFormatter numfmt_create( string $locale, int style[, string $pattern ] )
+ * Create number formatter.
+ */
+PHP_FUNCTION( numfmt_create )
+{
+       object_init_ex( return_value, NumberFormatter_ce_ptr );
+       numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
@@ -97,62 +87,8 @@ PHP_FUNCTION( numfmt_create )
  */
 PHP_METHOD( NumberFormatter, __construct )
 {
-       char*       locale;
-       char*       pattern = NULL;
-       int         locale_len = 0, pattern_len = 0;
-       long        style;
-       UChar*      spattern     = NULL;
-       int         spattern_len = 0;
-       FORMATTER_METHOD_INIT_VARS;
-
-       object = getThis();
-
-       // Parse parameters.
-       if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "sl|s",
-               &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE )
-       {
-               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                       "__construct: unable to parse input params", 0 TSRMLS_CC );
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
-       INTL_CHECK_LOCALE_LEN_OBJ(locale_len, object);
-       FORMATTER_METHOD_FETCH_OBJECT;
-
-       // Convert pattern (if specified) to UTF-16.
-       if(pattern && pattern_len) {
-               intl_convert_utf8_to_utf16(&spattern, &spattern_len, pattern, pattern_len, &INTL_DATA_ERROR_CODE(nfo));
-               if( U_FAILURE( INTL_DATA_ERROR_CODE((nfo)) ) )
-               {
-                       intl_error_set( NULL, INTL_DATA_ERROR_CODE( nfo ),
-                               "__construct: Error converting pattern to UTF-16", 0 TSRMLS_CC );
-                       zval_dtor(object);
-                       ZVAL_NULL(object);
-                       RETURN_NULL();
-               }
-       }
-
-       if(locale_len == 0) {
-               locale = INTL_G(default_locale);
-       }
-
-       // Create an ICU number formatter.
-       FORMATTER_OBJECT(nfo) = unum_open(style, spattern, spattern_len, locale, NULL, &INTL_DATA_ERROR_CODE(nfo));
-
-       if(spattern) {
-               efree(spattern);
-       }
-
-       if( U_FAILURE( INTL_DATA_ERROR_CODE((nfo)) ) )
-       {
-               intl_error_set( NULL, INTL_DATA_ERROR_CODE( nfo ),
-                       "__construct: number formatter creation failed", 0 TSRMLS_CC );
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
+       return_value = getThis();
+       numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
index ebbcb1660a7f835784966349a3bd867d1f4e0598..4c887abab038b7c6e7c275dff05119eeaaa1c3f4 100755 (executable)
@@ -64,13 +64,12 @@ typedef struct _intl_data {
     }
 
 // Check status, if error - destroy value and exit
-#define INTL_CTOR_CHECK_STATUS(obj, msg, val)                                                                          \
+#define INTL_CTOR_CHECK_STATUS(obj, msg)                                                                                       \
     intl_error_set_code( NULL, INTL_DATA_ERROR_CODE((obj)) TSRMLS_CC );                                \
     if( U_FAILURE( INTL_DATA_ERROR_CODE((obj)) ) )                                                                     \
     {                                                                                                                                                          \
         intl_errors_set_custom_msg( INTL_DATA_ERROR_P((obj)), msg, 0 TSRMLS_CC );      \
-               zval_dtor((val));                                                                                                                       \
-               ZVAL_NULL((val));                                                                                                                       \
+               zval_dtor(return_value);                                                                                                        \
         RETURN_NULL();                                                                                                                         \
     }
 
index 1c792aa81a86d5b6e84ccb00f0e77cac285660f1..88c586b7d9c9831aafb539f5a14855b397172d38 100755 (executable)
 #include "msgformat_class.h"
 #include "intl_convert.h"
 
-/* {{{ proto MessageFormatter MesssageFormatter::create( string $locale, string $pattern )
- * Create formatter. }}} */
-/* {{{ proto MessageFormatter msgfmt_create( string $locale, string $pattern )
- * Create formatter.
- */
-PHP_FUNCTION( msgfmt_create )
+/* {{{ */
+static msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) 
 {
        char*       locale;
        char*       pattern;
@@ -39,39 +35,26 @@ PHP_FUNCTION( msgfmt_create )
        int         spattern_len = 0;
        zval*       object;
        MessageFormatter_object* mfo;
-
        intl_error_reset( NULL TSRMLS_CC );
 
+       object = return_value;
        // Parse parameters.
        if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "ss",
                &locale, &locale_len, &pattern, &pattern_len ) == FAILURE )
        {
                intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
                        "msgfmt_create: unable to parse input parameters", 0 TSRMLS_CC );
-
+               zval_dtor(return_value);
                RETURN_NULL();
        }
 
        INTL_CHECK_LOCALE_LEN(locale_len);
-       // Create a MessageFormatter object and save the ICU formatter into it.
-       if( ( object = getThis() ) == NULL )
-               object = return_value;
-
-       if( Z_TYPE_P( object ) != IS_OBJECT )
-               object_init_ex( object, MessageFormatter_ce_ptr );
-
        MSG_FORMAT_METHOD_FETCH_OBJECT;
 
        // Convert pattern (if specified) to UTF-16.
        if(pattern && pattern_len) {
                intl_convert_utf8_to_utf16(&spattern, &spattern_len, pattern, pattern_len, &INTL_DATA_ERROR_CODE(mfo));
-               if( U_FAILURE( INTL_DATA_ERROR_CODE((mfo)) ) )
-               {
-                       intl_error_set( NULL, INTL_DATA_ERROR_CODE( mfo ),
-                               "msgfmt_create: error converting pattern to UTF-16", 0 TSRMLS_CC );
-                       zval_dtor(return_value);
-                       RETURN_NULL();
-               }
+               INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: error converting pattern to UTF-16");
        } else {
                spattern_len = 0;
                spattern = NULL;
@@ -81,11 +64,8 @@ PHP_FUNCTION( msgfmt_create )
                locale = INTL_G(default_locale);
        }
 
-       if(msfgotmat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
-               intl_error_set( NULL, U_INVALID_FORMAT_ERROR,
-                       "msgfmt_create: error converting pattern to quote-friendly format", 0 TSRMLS_CC );
-               zval_dtor(return_value);
-               RETURN_NULL();
+       if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
+               INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: error converting pattern to quote-friendly format");
        }
 
        (mfo)->mf_data.orig_format = estrndup(pattern, pattern_len);
@@ -98,13 +78,19 @@ PHP_FUNCTION( msgfmt_create )
                efree(spattern);
        }
 
-       if( U_FAILURE( INTL_DATA_ERROR_CODE((mfo)) ) )
-       {
-               intl_error_set( NULL, INTL_DATA_ERROR_CODE( mfo ),
-                       "msgfmt_create: message formatter creation failed", 0 TSRMLS_CC );
-               zval_dtor(return_value);
-               RETURN_NULL();
-       }
+       INTL_CTOR_CHECK_STATUS(mfo, "msgfmt_create: message formatter creation failed");
+}
+/* }}} */
+
+/* {{{ proto MessageFormatter MesssageFormatter::create( string $locale, string $pattern )
+ * Create formatter. }}} */
+/* {{{ proto MessageFormatter msgfmt_create( string $locale, string $pattern )
+ * Create formatter.
+ */
+PHP_FUNCTION( msgfmt_create )
+{
+       object_init_ex( return_value, MessageFormatter_ce_ptr );
+       msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
@@ -113,80 +99,8 @@ PHP_FUNCTION( msgfmt_create )
  */
 PHP_METHOD( MessageFormatter, __construct )
 {
-       char*       locale;
-       char*       pattern;
-       int         locale_len, pattern_len = 0;
-       UChar*      spattern     = NULL;
-       int         spattern_len = 0;
-       zval*       object;
-       MessageFormatter_object* mfo;
-
-       intl_error_reset( NULL TSRMLS_CC );
-
-       object = getThis();
-
-       // Parse parameters.
-       if( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "ss",
-               &locale, &locale_len, &pattern, &pattern_len ) == FAILURE )
-       {
-               intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR,
-                       "__construct: unable to parse input params", 0 TSRMLS_CC );
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
-       INTL_CHECK_LOCALE_LEN_OBJ(locale_len, object);
-       mfo = (MessageFormatter_object *) zend_object_store_get_object( object TSRMLS_CC );
-
-       intl_error_reset( &mfo->mf_data.error TSRMLS_CC );
-
-       // Convert pattern to UTF-16.
-       if(pattern && pattern_len) {
-               intl_convert_utf8_to_utf16(&spattern, &spattern_len, pattern, pattern_len, &INTL_DATA_ERROR_CODE(mfo));
-               if( U_FAILURE( INTL_DATA_ERROR_CODE((mfo)) ) )
-               {
-                       intl_error_set( NULL, INTL_DATA_ERROR_CODE( mfo ),
-                               "__construct: Error converting pattern to UTF-16", 0 TSRMLS_CC );
-                       zval_dtor(object);
-                       ZVAL_NULL(object);
-                       RETURN_NULL();
-               }
-       } else {
-               spattern_len = 0;
-               spattern = NULL;
-       }
-
-       if(locale_len == 0) {
-               locale = INTL_G(default_locale);
-       }
-
-       if(msfgotmat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
-               intl_error_set( NULL, U_INVALID_FORMAT_ERROR,
-                       "__construct: error converting pattern to quote-friendly format", 0 TSRMLS_CC );
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
-
-       (mfo)->mf_data.orig_format = estrndup(pattern, pattern_len);
-       (mfo)->mf_data.orig_format_len = pattern_len;
-       
-       // Create an ICU message formatter.
-       MSG_FORMAT_OBJECT(mfo) = umsg_open(spattern, spattern_len, locale, NULL, &INTL_DATA_ERROR_CODE(mfo));
-
-       if(spattern && spattern_len) {
-               efree(spattern);
-       }
-
-       if( U_FAILURE( INTL_DATA_ERROR_CODE((mfo)) ) )
-       {
-               intl_error_set( NULL, INTL_DATA_ERROR_CODE(mfo),
-                       "__construct: message formatter creation failed", 0 TSRMLS_CC );
-               zval_dtor(object);
-               ZVAL_NULL(object);
-               RETURN_NULL();
-       }
+       return_value = getThis();
+       msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU);
 }
 /* }}} */
 
index 62e797abca52bf685fb0493b4943dbdd58926d30..fed29f2ea77bb805f56faa099599668a8f1873b1 100755 (executable)
@@ -85,7 +85,7 @@ PHP_FUNCTION( msgfmt_set_pattern )
        intl_convert_utf8_to_utf16(&spattern, &spattern_len, value, value_len, &INTL_DATA_ERROR_CODE(mfo));
        INTL_METHOD_CHECK_STATUS(mfo, "Error converting pattern to UTF-16" );
 
-       if(msfgotmat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
+       if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
                intl_error_set( NULL, U_INVALID_FORMAT_ERROR,
                        "msgfmt_set_pattern: error converting pattern to quote-friendly format", 0 TSRMLS_CC );
                RETURN_FALSE;
index aad36f594d68583a19bf45f99c2bd2dab31386ab..95e81d3ea74fb578bd0e4c3df2a3c2bb09352b2c 100755 (executable)
@@ -69,7 +69,7 @@ msgformat_data* msgformat_data_create( TSRMLS_D )
 }
 /* }}} */
 
-int msfgotmat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) 
+int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) 
 {
        if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) {
                UChar *npattern = emalloc(sizeof(UChar)*(2*(*spattern_len)+1));
index dc1c0abdb7e6ca7e8ad55bb2edbbd98565e219be..a755c1c7dc5cad88c9d006aac412c94821354c11 100755 (executable)
@@ -154,7 +154,7 @@ PHP_FUNCTION( msgfmt_format_message )
                slocale = INTL_G(default_locale);
        }
 
-       if(msfgotmat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
+       if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
                intl_error_set( NULL, U_INVALID_FORMAT_ERROR,
                        "msgfmt_format_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC );
                RETURN_FALSE;
index decd737a6c68f5a817ac7a02ddaad1356961439f..3318292398280cb428eafc14aa2e3148bf8f2d38 100755 (executable)
@@ -127,7 +127,7 @@ PHP_FUNCTION( msgfmt_parse_message )
                slocale = INTL_G(default_locale);
        }
 
-       if(msfgotmat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
+       if(msgformat_fix_quotes(&spattern, &spattern_len, &INTL_DATA_ERROR_CODE(mfo)) != SUCCESS) {
                intl_error_set( NULL, U_INVALID_FORMAT_ERROR,
                        "msgfmt_parse_message: error converting pattern to quote-friendly format", 0 TSRMLS_CC );
                RETURN_FALSE;
index c313df57a6a16810af4fa9db96b9cac6c8b1a393..295f011008d6c5e745a0ec0648ad49500c7280a2 100755 (executable)
@@ -52,28 +52,28 @@ foreach($args as $arg) {
 ?>
 --EXPECTF--
 Warning: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d
-'__construct: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR'
+'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d
 'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: NumberFormatter::create() expects at least 2 parameters, 0 given in %s on line %d
 'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
-'__construct: number formatter creation failed: U_UNSUPPORTED_ERROR'
+'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
 
 Warning: NumberFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
-'__construct: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR'
+'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d
 'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: numfmt_create() expects parameter 1 to be string, array given in %s on line %d
 'numfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
-'__construct: number formatter creation failed: U_UNSUPPORTED_ERROR'
 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
 'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
-'__construct: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
+'numfmt_create: number formatter creation failed: U_UNSUPPORTED_ERROR'
+'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
+'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
 'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
-'numfmt_create: number formatter creation failed: U_MEMORY_ALLOCATION_ERROR'
\ No newline at end of file
index f7d0276844591bf63b1a1a9f4ee454e518f07fc9..c26a54e9ef2f0ed9da535f465bb1aebb3408969a 100755 (executable)
@@ -59,7 +59,7 @@ foreach($args as $arg) {
 ?>
 --EXPECTF--
 Warning: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d
-'__construct: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d
 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
@@ -68,34 +68,34 @@ Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s
 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d
-'__construct: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d
 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: MessageFormatter::create() expects exactly 2 parameters, 1 given in %s on line %d
 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
-'__construct: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
-'__construct: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d
-'__construct: unable to parse input params: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d
 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
 
 Warning: msgfmt_create() expects parameter 1 to be string, array given in %s on line %d
 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR'
-'__construct: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
 'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
-'__construct: message formatter creation failed: U_UNMATCHED_BRACES'
+'msgfmt_create: message formatter creation failed: U_ILLEGAL_ARGUMENT_ERROR'
+'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
 'msgfmt_create: message formatter creation failed: U_UNMATCHED_BRACES'
-'__construct: Error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
 'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
-'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
\ No newline at end of file
+'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'
+'msgfmt_create: error converting pattern to UTF-16: U_INVALID_CHAR_FOUND'