Allowing catching arg type deprecations in intl classes

Closes GH-8115
Closes GH-8117
This commit is contained in:
Ilija Tovilo 2022-02-18 13:23:57 +01:00
parent 723058c3bf
commit 925a30979c
No known key found for this signature in database
GPG key ID: A4F5D403F118200A
10 changed files with 136 additions and 39 deletions

View file

@ -31,7 +31,7 @@ static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
return (RuleBasedBreakIterator*)bio->biter;
}
static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{
char *rules;
size_t rules_len;
@ -51,6 +51,9 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
RETURN_THROWS();
}
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
// instantiation of ICU object
RuleBasedBreakIterator *rbbi;
@ -95,11 +98,13 @@ static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, __construct)
{
zend_error_handling error_handling;
bool error_handling_replaced = 0;
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = ZEND_THIS;
_php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
zend_restore_error_handling(&error_handling);
_php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced);
if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
}
U_CFUNC PHP_METHOD(IntlRuleBasedBreakIterator, getRules)