diff options
| author | Aaron Piotrowski <aaron@trowski.com> | 2016-07-05 02:08:39 -0500 |
|---|---|---|
| committer | Aaron Piotrowski <aaron@trowski.com> | 2016-07-05 02:08:39 -0500 |
| commit | 24237027bc7e4f7aed9287fe9815c0577eeb1c22 (patch) | |
| tree | bc23b05ba89a75f0e0711933371f708b96e63345 /ext/intl | |
| parent | 42666da1714673d537356221e688f57f404fe1d2 (diff) | |
| parent | e9832b5ab1d986ddd3ea0705bcbc5a391dc16614 (diff) | |
| download | php-git-24237027bc7e4f7aed9287fe9815c0577eeb1c22.tar.gz | |
Merge branch 'throw-error-in-extensions'
Diffstat (limited to 'ext/intl')
| -rw-r--r-- | ext/intl/collator/collator_compare.c | 2 | ||||
| -rw-r--r-- | ext/intl/collator/collator_locale.c | 2 | ||||
| -rw-r--r-- | ext/intl/collator/collator_sort.c | 8 | ||||
| -rw-r--r-- | ext/intl/idn/idn.c | 5 | ||||
| -rw-r--r-- | ext/intl/tests/bug60192-compare.phpt | 6 | ||||
| -rw-r--r-- | ext/intl/tests/bug60192-getlocale.phpt | 6 | ||||
| -rw-r--r-- | ext/intl/tests/bug60192-getsortkey.phpt | 6 | ||||
| -rw-r--r-- | ext/intl/tests/bug60192-sort.phpt | 7 | ||||
| -rw-r--r-- | ext/intl/tests/bug60192-sortwithsortkeys.phpt | 7 | ||||
| -rw-r--r-- | ext/intl/transliterator/transliterator_class.c | 2 |
10 files changed, 38 insertions, 13 deletions
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c index a7bc7f6383..983b9d7f2c 100644 --- a/ext/intl/collator/collator_compare.c +++ b/ext/intl/collator/collator_compare.c @@ -62,7 +62,7 @@ PHP_FUNCTION( collator_compare ) intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) ); intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), "Object not initialized", 0 ); - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized"); + zend_throw_error(NULL, "Object not initialized"); RETURN_FALSE; } diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c index 8e0b32650a..b3ea572be1 100644 --- a/ext/intl/collator/collator_locale.c +++ b/ext/intl/collator/collator_locale.c @@ -55,7 +55,7 @@ PHP_FUNCTION( collator_get_locale ) intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) ); intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), "Object not initialized", 0 ); - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized"); + zend_throw_error(NULL, "Object not initialized"); RETURN_FALSE; } diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 7ad8f8fc8c..69629558d1 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -75,8 +75,8 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2) intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) ); intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), "Object not initialized", 0 ); - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized"); - + zend_throw_error(NULL, "Object not initialized"); + return FAILURE; } /* Compare the strings using ICU. */ @@ -404,7 +404,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys ) intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) ); intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), "Object not initialized", 0 ); - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized"); + zend_throw_error(NULL, "Object not initialized"); RETURN_FALSE; } @@ -570,7 +570,7 @@ PHP_FUNCTION( collator_get_sort_key ) intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) ); intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ), "Object not initialized", 0 ); - php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized"); + zend_throw_error(NULL, "Object not initialized"); RETURN_FALSE; } diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index 6e699604df..1489dab9b1 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -165,7 +165,10 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, RETURN_FALSE; } if (len >= 255) { - php_error_docref(NULL, E_ERROR, "ICU returned an unexpected length"); + zend_throw_error(NULL, "ICU returned an unexpected length"); + uidna_close(uts46); + zend_string_free(buffer); + RETURN_FALSE; } ZSTR_VAL(buffer)[len] = '\0'; diff --git a/ext/intl/tests/bug60192-compare.phpt b/ext/intl/tests/bug60192-compare.phpt index 12f3273538..ce9728023a 100644 --- a/ext/intl/tests/bug60192-compare.phpt +++ b/ext/intl/tests/bug60192-compare.phpt @@ -16,4 +16,8 @@ $c = new Collator2(); $a = $c->compare('h', 'H'); --EXPECTF-- -Catchable fatal error: Collator::compare(): Object not initialized in %s on line %d +Fatal error: Uncaught Error: Object not initialized in %s:%d +Stack trace: +#0 %s(%d): Collator->compare('h', 'H') +#1 {main} + thrown in %s on line %d diff --git a/ext/intl/tests/bug60192-getlocale.phpt b/ext/intl/tests/bug60192-getlocale.phpt index 9f340c5f67..c4155e9ab5 100644 --- a/ext/intl/tests/bug60192-getlocale.phpt +++ b/ext/intl/tests/bug60192-getlocale.phpt @@ -17,4 +17,8 @@ $c = new Collator2(); $c->getLocale(Locale::ACTUAL_LOCALE); --EXPECTF-- -Catchable fatal error: Collator::getLocale(): Object not initialized in %s on line %d +Fatal error: Uncaught Error: Object not initialized in %s:%d +Stack trace: +#0 %s(%d): Collator->getLocale(0) +#1 {main} + thrown in %s on line %d diff --git a/ext/intl/tests/bug60192-getsortkey.phpt b/ext/intl/tests/bug60192-getsortkey.phpt index f3e68f9c61..0d0f07e768 100644 --- a/ext/intl/tests/bug60192-getsortkey.phpt +++ b/ext/intl/tests/bug60192-getsortkey.phpt @@ -17,4 +17,8 @@ $c = new Collator2(); $c->getSortKey('h'); --EXPECTF-- -Catchable fatal error: Collator::getSortKey(): Object not initialized in %s on line %d +Fatal error: Uncaught Error: Object not initialized in %s:%d +Stack trace: +#0 %s(%d): Collator->getSortKey('h') +#1 {main} + thrown in %s on line %d diff --git a/ext/intl/tests/bug60192-sort.phpt b/ext/intl/tests/bug60192-sort.phpt index ee506d3a5a..c452d0de6d 100644 --- a/ext/intl/tests/bug60192-sort.phpt +++ b/ext/intl/tests/bug60192-sort.phpt @@ -18,4 +18,9 @@ $a = array('a', 'b'); $c->sort($a); --EXPECTF-- -Catchable fatal error: Collator::sort(): Object not initialized in %s on line %d +Fatal error: Uncaught Error: Object not initialized in %s:%d +Stack trace: +#0 %s(%d): Collator->sort(Array) +#1 {main} + thrown in %s on line %d + diff --git a/ext/intl/tests/bug60192-sortwithsortkeys.phpt b/ext/intl/tests/bug60192-sortwithsortkeys.phpt index c26b2daf85..e7d7c1dc1d 100644 --- a/ext/intl/tests/bug60192-sortwithsortkeys.phpt +++ b/ext/intl/tests/bug60192-sortwithsortkeys.phpt @@ -18,4 +18,9 @@ $a = array('a', 'b'); $c->sortWithSortKeys($a); --EXPECTF-- -Catchable fatal error: Collator::sortWithSortKeys(): Object not initialized in %s on line %d +Fatal error: Uncaught Error: Object not initialized in %s:%d +Stack trace: +#0 %s(%d): Collator->sortWithSortKeys(Array) +#1 {main} + thrown in %s on line %d + diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index ba207a021c..beeee41d8e 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -183,7 +183,7 @@ err: "Could not clone transliterator", 0 ); err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) ); - php_error_docref( NULL, E_ERROR, "%s", ZSTR_VAL(err_msg) ); + zend_throw_error( NULL, "%s", ZSTR_VAL(err_msg) ); zend_string_free( err_msg ); /* if it's changed into a warning */ /* do not destroy tempz; we need to return something */ } |
