diff options
Diffstat (limited to 'ext/intl')
| -rw-r--r-- | ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp | 3 | ||||
| -rw-r--r-- | ext/intl/calendar/gregoriancalendar_methods.cpp | 13 | ||||
| -rw-r--r-- | ext/intl/collator/collator_create.c | 9 | ||||
| -rw-r--r-- | ext/intl/converter/converter.c | 11 | ||||
| -rw-r--r-- | ext/intl/dateformat/dateformat_create.cpp | 9 | ||||
| -rw-r--r-- | ext/intl/formatter/formatter_main.c | 9 | ||||
| -rw-r--r-- | ext/intl/intl_error.c | 10 | ||||
| -rw-r--r-- | ext/intl/intl_error.h | 8 | ||||
| -rw-r--r-- | ext/intl/msgformat/msgformat.c | 9 | ||||
| -rw-r--r-- | ext/intl/resourcebundle/resourcebundle_class.c | 9 | ||||
| -rw-r--r-- | ext/intl/spoofchecker/spoofchecker_create.c | 7 | ||||
| -rw-r--r-- | ext/intl/tests/breakiter___construct_error.phpt | 6 | ||||
| -rw-r--r-- | ext/intl/tests/formatter_fail.phpt | 17 | ||||
| -rw-r--r-- | ext/intl/tests/gregoriancalendar___construct_error.phpt | 2 | ||||
| -rw-r--r-- | ext/intl/tests/msgfmt_fail.phpt | 25 | ||||
| -rw-r--r-- | ext/intl/tests/msgfmt_fail2.phpt | 25 |
16 files changed, 85 insertions, 87 deletions
diff --git a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp index b43f8212d0..4dee58df2e 100644 --- a/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp +++ b/ext/intl/breakiterator/rulebasedbreakiterator_methods.cpp @@ -32,14 +32,13 @@ static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) { static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS) { - zval *object = getThis(); char *rules; size_t rules_len; zend_bool compiled = 0; UErrorCode status = U_ZERO_ERROR; intl_error_reset(NULL); - if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|b", &rules, &rules_len, &compiled) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "rbbi_create_instance: bad arguments", 0); diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index d9572a0668..d970cab595 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -38,7 +38,8 @@ static inline GregorianCalendar *fetch_greg(Calendar_object *co) { return (GregorianCalendar*)co->ucal; } -static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) +static void _php_intlgregcal_constructor_body( + INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) { zval *tz_object = NULL; zval args_a[6] = {0}, @@ -48,6 +49,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) zend_long largs[6]; UErrorCode status = U_ZERO_ERROR; int variant; + int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset(NULL); // parameter number validation / variant determination @@ -71,7 +73,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) // argument parsing if (variant <= 2) { - if (zend_parse_parameters(MIN(ZEND_NUM_ARGS(), 2), + if (zend_parse_parameters_ex(zpp_flags, MIN(ZEND_NUM_ARGS(), 2), "|z!s!", &tz_object, &locale, &locale_len) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlgregcal_create_instance: bad arguments", 0); @@ -79,7 +81,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS) return; } } - if (variant > 2 && zend_parse_parameters(ZEND_NUM_ARGS(), + if (variant > 2 && zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "lll|lll", &largs[0], &largs[1], &largs[2], &largs[3], &largs[4], &largs[5]) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -181,7 +183,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_create_instance) object_init_ex(return_value, GregorianCalendar_ce_ptr); ZVAL_COPY_VALUE(&orig, return_value); - _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); + _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { zval_dtor(&orig); @@ -195,8 +197,7 @@ U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct) zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); return_value = getThis(); - //changes this to IS_NULL (without first destroying) if there's an error - _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU); + _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { if (!EG(exception)) { zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); diff --git a/ext/intl/collator/collator_create.c b/ext/intl/collator/collator_create.c index c6bc3fd209..b6ad4502db 100644 --- a/ext/intl/collator/collator_create.c +++ b/ext/intl/collator/collator_create.c @@ -25,17 +25,18 @@ #include "intl_data.h" /* {{{ */ -static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) { const char* locale; size_t locale_len = 0; zval* object; Collator_object* co; + int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset( NULL ); object = return_value; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS(), "s", + if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s", &locale, &locale_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -63,7 +64,7 @@ static void collator_ctor(INTERNAL_FUNCTION_PARAMETERS) PHP_FUNCTION( collator_create ) { object_init_ex( return_value, Collator_ce_ptr ); - collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ @@ -76,7 +77,7 @@ PHP_METHOD( Collator, __construct ) zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); return_value = getThis(); - collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { if (!EG(exception)) { zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c index fd3aced34d..621d0ead12 100644 --- a/ext/intl/converter/converter.c +++ b/ext/intl/converter/converter.c @@ -557,19 +557,10 @@ static PHP_METHOD(UConverter, __construct) { size_t src_len = sizeof("utf-8") - 1; char *dest = src; size_t dest_len = src_len; - zend_error_handling zeh; - int rv; intl_error_reset(NULL); - zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &zeh); - rv = zend_parse_parameters(ZEND_NUM_ARGS(), "|s!s!", - &dest, &dest_len, &src, &src_len); - zend_restore_error_handling(&zeh); - - if (rv == FAILURE) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, - "UConverter::__construct(): bad arguments", 0); + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|s!s!", &dest, &dest_len, &src, &src_len) == FAILURE) { return; } diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index b7ad7b5126..afc182131d 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -37,7 +37,7 @@ extern "C" { #include "zend_exceptions.h" /* {{{ */ -static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) { zval *object; @@ -58,11 +58,12 @@ static void datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) UChar* svalue = NULL; /* UTF-16 pattern_str */ int32_t slength = 0; IntlDateFormatter_object* dfo; + int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset(NULL); object = return_value; /* Parse parameters. */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|zzs", + if (zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(), "sll|zzs", &locale_str, &locale_len, &date_type, &time_type, &timezone_zv, &calendar_zv, &pattern_str, &pattern_str_len) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: " @@ -176,7 +177,7 @@ error: U_CFUNC PHP_FUNCTION( datefmt_create ) { object_init_ex( return_value, IntlDateFormatter_ce_ptr ); - datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { RETURN_NULL(); } @@ -194,7 +195,7 @@ U_CFUNC PHP_METHOD( IntlDateFormatter, __construct ) /* return_value param is being changed, therefore we will always return * NULL here */ return_value = getThis(); - datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { if (!EG(exception)) { zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); diff --git a/ext/intl/formatter/formatter_main.c b/ext/intl/formatter/formatter_main.c index 5d5a139688..5b7e634053 100644 --- a/ext/intl/formatter/formatter_main.c +++ b/ext/intl/formatter/formatter_main.c @@ -25,7 +25,7 @@ #include "intl_convert.h" /* {{{ */ -static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) { const char* locale; char* pattern = NULL; @@ -33,10 +33,11 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) zend_long style; UChar* spattern = NULL; int32_t spattern_len = 0; + int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; FORMATTER_METHOD_INIT_VARS; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS(), "sl|s", + if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "sl|s", &locale, &locale_len, &style, &pattern, &pattern_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -78,7 +79,7 @@ static void numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) PHP_FUNCTION( numfmt_create ) { object_init_ex( return_value, NumberFormatter_ce_ptr ); - numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { RETURN_NULL(); } @@ -94,7 +95,7 @@ PHP_METHOD( NumberFormatter, __construct ) zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); return_value = getThis(); - numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { if (!EG(exception)) { zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); diff --git a/ext/intl/intl_error.c b/ext/intl/intl_error.c index a946705a76..adbdd5afb8 100644 --- a/ext/intl/intl_error.c +++ b/ext/intl/intl_error.c @@ -101,7 +101,7 @@ void intl_error_reset( intl_error* err ) /* {{{ void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg ) * Set last error message to msg copying it if needed. */ -void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg ) +void intl_error_set_custom_msg( intl_error* err, const char* msg, int copyMsg ) { if( !msg ) return; @@ -122,7 +122,7 @@ void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg ) err->free_custom_error_message = copyMsg; /* Set user's error text message */ - err->custom_error_message = copyMsg ? estrdup( msg ) : msg; + err->custom_error_message = copyMsg ? estrdup( msg ) : (char *) msg; } /* }}} */ @@ -180,7 +180,7 @@ UErrorCode intl_error_get_code( intl_error* err ) /* {{{ void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ) * Set error code and message. */ -void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ) +void intl_error_set( intl_error* err, UErrorCode code, const char* msg, int copyMsg ) { intl_error_set_code( err, code ); intl_error_set_custom_msg( err, msg, copyMsg ); @@ -190,7 +190,7 @@ void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ) /* {{{ void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ) * Set error code and message. */ -void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ) +void intl_errors_set( intl_error* err, UErrorCode code, const char* msg, int copyMsg ) { intl_errors_set_code( err, code ); intl_errors_set_custom_msg( err, msg, copyMsg ); @@ -210,7 +210,7 @@ void intl_errors_reset( intl_error* err ) /* {{{ void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg ) */ -void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg ) +void intl_errors_set_custom_msg( intl_error* err, const char* msg, int copyMsg ) { if(err) { intl_error_set_custom_msg( err, msg, copyMsg ); diff --git a/ext/intl/intl_error.h b/ext/intl/intl_error.h index 02d62f0299..b65bb2abee 100644 --- a/ext/intl/intl_error.h +++ b/ext/intl/intl_error.h @@ -35,16 +35,16 @@ intl_error* intl_error_create( void ); void intl_error_init( intl_error* err ); void intl_error_reset( intl_error* err ); void intl_error_set_code( intl_error* err, UErrorCode err_code ); -void intl_error_set_custom_msg( intl_error* err, char* msg, int copyMsg ); -void intl_error_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ); +void intl_error_set_custom_msg( intl_error* err, const char* msg, int copyMsg ); +void intl_error_set( intl_error* err, UErrorCode code, const char* msg, int copyMsg ); UErrorCode intl_error_get_code( intl_error* err ); zend_string* intl_error_get_message( intl_error* err ); // Wrappers to synchonize object's and global error structures. void intl_errors_reset( intl_error* err ); -void intl_errors_set_custom_msg( intl_error* err, char* msg, int copyMsg ); +void intl_errors_set_custom_msg( intl_error* err, const char* msg, int copyMsg ); void intl_errors_set_code( intl_error* err, UErrorCode err_code ); -void intl_errors_set( intl_error* err, UErrorCode code, char* msg, int copyMsg ); +void intl_errors_set( intl_error* err, UErrorCode code, const char* msg, int copyMsg ); // Other error helpers smart_str intl_parse_error_to_string( UParseError* pe ); diff --git a/ext/intl/msgformat/msgformat.c b/ext/intl/msgformat/msgformat.c index 15d6ef8321..2675aca5b8 100644 --- a/ext/intl/msgformat/msgformat.c +++ b/ext/intl/msgformat/msgformat.c @@ -26,7 +26,7 @@ #include "intl_convert.h" /* {{{ */ -static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) { const char* locale; char* pattern; @@ -35,11 +35,12 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) int spattern_len = 0; zval* object; MessageFormatter_object* mfo; + int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; intl_error_reset( NULL ); object = return_value; /* Parse parameters. */ - if( zend_parse_parameters( ZEND_NUM_ARGS(), "ss", + if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "ss", &locale, &locale_len, &pattern, &pattern_len ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -96,7 +97,7 @@ static void msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) PHP_FUNCTION( msgfmt_create ) { object_init_ex( return_value, MessageFormatter_ce_ptr ); - msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { RETURN_NULL(); } @@ -112,7 +113,7 @@ PHP_METHOD( MessageFormatter, __construct ) zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); return_value = getThis(); - msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { if (!EG(exception)) { zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); diff --git a/ext/intl/resourcebundle/resourcebundle_class.c b/ext/intl/resourcebundle/resourcebundle_class.c index d8d1aa0d9c..a42556f746 100644 --- a/ext/intl/resourcebundle/resourcebundle_class.c +++ b/ext/intl/resourcebundle/resourcebundle_class.c @@ -75,20 +75,21 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce ) /* }}} */ /* {{{ ResourceBundle_ctor */ -static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) +static void resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor) { const char *bundlename; size_t bundlename_len = 0; const char *locale; size_t locale_len = 0; zend_bool fallback = 1; + int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0; zval *object = return_value; ResourceBundle_object *rb = Z_INTL_RESOURCEBUNDLE_P( object ); intl_error_reset( NULL ); - if( zend_parse_parameters( ZEND_NUM_ARGS(), "s!s!|b", + if( zend_parse_parameters_ex( zpp_flags, ZEND_NUM_ARGS(), "s!s!|b", &locale, &locale_len, &bundlename, &bundlename_len, &fallback ) == FAILURE ) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, @@ -144,7 +145,7 @@ PHP_METHOD( ResourceBundle, __construct ) zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); return_value = getThis(); - resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { if (!EG(exception)) { zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); @@ -160,7 +161,7 @@ proto ResourceBundle resourcebundle_create( string $locale [, string $bundlename PHP_FUNCTION( resourcebundle_create ) { object_init_ex( return_value, ResourceBundle_ce_ptr ); - resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU); + resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) { RETURN_NULL(); } diff --git a/ext/intl/spoofchecker/spoofchecker_create.c b/ext/intl/spoofchecker/spoofchecker_create.c index d206bc81cb..865f600dfc 100644 --- a/ext/intl/spoofchecker/spoofchecker_create.c +++ b/ext/intl/spoofchecker/spoofchecker_create.c @@ -32,13 +32,12 @@ PHP_METHOD(Spoofchecker, __construct) zend_error_handling error_handling; SPOOFCHECKER_METHOD_INIT_VARS; - zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); - - if (zend_parse_parameters_none() == FAILURE) { - zend_restore_error_handling(&error_handling); + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "") == FAILURE) { return; } + zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling); + SPOOFCHECKER_METHOD_FETCH_OBJECT_NO_CHECK; co->uspoof = uspoof_open(SPOOFCHECKER_ERROR_CODE_P(co)); diff --git a/ext/intl/tests/breakiter___construct_error.phpt b/ext/intl/tests/breakiter___construct_error.phpt index bea65667fa..7e67fd7403 100644 --- a/ext/intl/tests/breakiter___construct_error.phpt +++ b/ext/intl/tests/breakiter___construct_error.phpt @@ -19,17 +19,17 @@ try { } try { var_dump(new IntlRuleBasedBreakIterator()); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); } try { var_dump(new IntlRuleBasedBreakIterator(1,2,3)); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); } try { var_dump(new IntlRuleBasedBreakIterator('[\p{Letter}\uFFFD]+;[:number:]+;', array())); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); } try { diff --git a/ext/intl/tests/formatter_fail.phpt b/ext/intl/tests/formatter_fail.phpt index f61cb14878..f7761173dd 100644 --- a/ext/intl/tests/formatter_fail.phpt +++ b/ext/intl/tests/formatter_fail.phpt @@ -12,7 +12,8 @@ function err($fmt) { } function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\n" . get_class($e) . ": " . $e->getMessage() + . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { @@ -20,7 +21,7 @@ function crt($t, $l, $s) { case $t == "O": try { return new NumberFormatter($l, $s); - } catch (IntlException $e) { + } catch (BaseException $e) { print_exception($e); return null; } @@ -44,7 +45,7 @@ $args = array( try { $fmt = new NumberFormatter(); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); $fmt = null; } @@ -65,7 +66,7 @@ foreach($args as $arg) { ?> --EXPECTF-- -Exception: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d +TypeException: NumberFormatter::__construct() expects at least 2 parameters, 0 given in %s on line %d '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 @@ -74,12 +75,12 @@ Warning: numfmt_create() expects at least 2 parameters, 0 given in %s on line %d 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' -Exception: Constructor failed in %sformatter_fail.php on line %d +IntlException: Constructor failed in %sformatter_fail.php on line %d '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' -Exception: NumberFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d +TypeException: NumberFormatter::__construct() 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: NumberFormatter::create() expects parameter 1 to be string, array given in %s on line %d @@ -88,12 +89,12 @@ Warning: NumberFormatter::create() expects parameter 1 to be string, array given 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' -Exception: Constructor failed in %sformatter_fail.php on line %d +IntlException: Constructor failed in %sformatter_fail.php on line %d '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' -Exception: Constructor failed in %sformatter_fail.php on line %d +IntlException: Constructor failed in %sformatter_fail.php on line %d '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' diff --git a/ext/intl/tests/gregoriancalendar___construct_error.phpt b/ext/intl/tests/gregoriancalendar___construct_error.phpt index d81809793e..7383bdee88 100644 --- a/ext/intl/tests/gregoriancalendar___construct_error.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_error.phpt @@ -22,7 +22,7 @@ try { } try { var_dump(new IntlGregorianCalendar(1,2,3,4,NULL,array())); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); } --EXPECTF-- diff --git a/ext/intl/tests/msgfmt_fail.phpt b/ext/intl/tests/msgfmt_fail.phpt index 7c76598c0d..d7ca83d442 100644 --- a/ext/intl/tests/msgfmt_fail.phpt +++ b/ext/intl/tests/msgfmt_fail.phpt @@ -13,7 +13,8 @@ function err($fmt) { } function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\n" . get_class($e) . ": " . $e->getMessage() + . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { @@ -21,7 +22,7 @@ function crt($t, $l, $s) { case $t == "O": try { return new MessageFormatter($l, $s); - } catch (IntlException $e) { + } catch (BaseException $e) { print_exception($e); return null; } @@ -46,7 +47,7 @@ $args = array( try { $fmt = new MessageFormatter(); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); $fmt = null; } @@ -57,7 +58,7 @@ $fmt = MessageFormatter::create(); err($fmt); try { $fmt = new MessageFormatter('en'); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); $fmt = null; } @@ -78,7 +79,7 @@ foreach($args as $arg) { ?> --EXPECTF-- -Exception: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d +TypeException: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d '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 @@ -87,7 +88,7 @@ Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' -Exception: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d +TypeException: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d '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 @@ -96,17 +97,17 @@ Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d 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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d +TypeException: MessageFormatter::__construct() 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: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d @@ -115,17 +116,17 @@ Warning: MessageFormatter::create() expects parameter 1 to be string, array give 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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d 'msgfmt_create: 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' diff --git a/ext/intl/tests/msgfmt_fail2.phpt b/ext/intl/tests/msgfmt_fail2.phpt index 0ab99cf633..6e34bfde68 100644 --- a/ext/intl/tests/msgfmt_fail2.phpt +++ b/ext/intl/tests/msgfmt_fail2.phpt @@ -13,7 +13,8 @@ function err($fmt) { } function print_exception($e) { - echo "\nException: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; + echo "\n" . get_class($e) . ": " . $e->getMessage() + . " in " . $e->getFile() . " on line " . $e->getLine() . "\n"; } function crt($t, $l, $s) { @@ -21,7 +22,7 @@ function crt($t, $l, $s) { case $t == "O": try { return new MessageFormatter($l, $s); - } catch (IntlException $e) { + } catch (BaseException $e) { print_exception($e); return null; } @@ -46,7 +47,7 @@ $args = array( try { $fmt = new MessageFormatter(); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); $fmt = null; } @@ -57,7 +58,7 @@ $fmt = MessageFormatter::create(); err($fmt); try { $fmt = new MessageFormatter('en'); -} catch (IntlException $e) { +} catch (TypeException $e) { print_exception($e); $fmt = null; } @@ -78,7 +79,7 @@ foreach($args as $arg) { ?> --EXPECTF-- -Exception: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d +TypeException: MessageFormatter::__construct() expects exactly 2 parameters, 0 given in %s on line %d '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 @@ -87,7 +88,7 @@ Warning: msgfmt_create() expects exactly 2 parameters, 0 given in %s on line %d Warning: MessageFormatter::create() expects exactly 2 parameters, 0 given in %s on line %d 'msgfmt_create: unable to parse input parameters: U_ILLEGAL_ARGUMENT_ERROR' -Exception: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d +TypeException: MessageFormatter::__construct() expects exactly 2 parameters, 1 given in %s on line %d '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 @@ -96,17 +97,17 @@ Warning: msgfmt_create() expects exactly 2 parameters, 1 given in %s on line %d 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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: MessageFormatter::__construct() expects parameter 1 to be string, array given in %s on line %d +TypeException: MessageFormatter::__construct() 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: MessageFormatter::create() expects parameter 1 to be string, array given in %s on line %d @@ -115,17 +116,17 @@ Warning: MessageFormatter::create() expects parameter 1 to be string, array give 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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d 'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR' 'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR' 'msgfmt_create: message formatter creation failed: U_PATTERN_SYNTAX_ERROR' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d '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' -Exception: Constructor failed in %smsgfmt_fail2.php on line %d +IntlException: Constructor failed in %smsgfmt_fail2.php on line %d 'msgfmt_create: 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' |
