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

3
NEWS
View file

@ -2,6 +2,9 @@ PHP NEWS
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.1.5 ?? ??? ????, PHP 8.1.5
- Intl:
. Fixed bug GH-8115 (Can't catch arg type deprecation when instantiating Intl
classes). (ilutov)
17 Mar 2022, PHP 8.1.4 17 Mar 2022, PHP 8.1.4

View file

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

View file

@ -44,7 +44,7 @@ static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
} }
static void _php_intlgregcal_constructor_body( static void _php_intlgregcal_constructor_body(
INTERNAL_FUNCTION_PARAMETERS, bool is_constructor) INTERNAL_FUNCTION_PARAMETERS, bool is_constructor, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
zval *tz_object = NULL; zval *tz_object = NULL;
zval args_a[6], zval args_a[6],
@ -84,6 +84,11 @@ static void _php_intlgregcal_constructor_body(
RETURN_THROWS(); RETURN_THROWS();
} }
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
// instantion of ICU object // instantion of ICU object
Calendar_object *co = Z_INTL_CALENDAR_P(return_value); Calendar_object *co = Z_INTL_CALENDAR_P(return_value);
GregorianCalendar *gcal = NULL; GregorianCalendar *gcal = NULL;
@ -188,17 +193,19 @@ U_CFUNC PHP_FUNCTION(intlgregcal_create_instance)
intl_error_reset(NULL); intl_error_reset(NULL);
object_init_ex(return_value, GregorianCalendar_ce_ptr); object_init_ex(return_value, GregorianCalendar_ce_ptr);
_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, /* is_constructor */ 0, NULL, NULL);
} }
U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct) U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct)
{ {
zend_error_handling error_handling; 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; return_value = ZEND_THIS;
_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, /* is_constructor */ 1, &error_handling, &error_handling_replaced);
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }
U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change) U_CFUNC PHP_FUNCTION(intlgregcal_set_gregorian_change)

View file

@ -22,7 +22,7 @@
#include "intl_data.h" #include "intl_data.h"
/* {{{ */ /* {{{ */
static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS) static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
const char* locale; const char* locale;
size_t locale_len = 0; size_t locale_len = 0;
@ -38,6 +38,11 @@ static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
return FAILURE; return FAILURE;
} }
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len); INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len);
COLLATOR_METHOD_FETCH_OBJECT; COLLATOR_METHOD_FETCH_OBJECT;
@ -56,7 +61,7 @@ static int collator_ctor(INTERNAL_FUNCTION_PARAMETERS)
PHP_FUNCTION( collator_create ) PHP_FUNCTION( collator_create )
{ {
object_init_ex( return_value, Collator_ce_ptr ); object_init_ex( return_value, Collator_ce_ptr );
if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, NULL, NULL) == FAILURE) {
zval_ptr_dtor(return_value); zval_ptr_dtor(return_value);
RETURN_NULL(); RETURN_NULL();
} }
@ -67,14 +72,16 @@ PHP_FUNCTION( collator_create )
PHP_METHOD( Collator, __construct ) PHP_METHOD( Collator, __construct )
{ {
zend_error_handling error_handling; 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; return_value = ZEND_THIS;
if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (collator_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
} }
} }
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }
/* }}} */ /* }}} */

View file

@ -45,7 +45,7 @@ extern "C" {
UDAT_PATTERN == (i)) UDAT_PATTERN == (i))
/* {{{ */ /* {{{ */
static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS) static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
zval *object; zval *object;
char *locale_str; char *locale_str;
@ -81,6 +81,11 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
Z_PARAM_STRING_OR_NULL(pattern_str, pattern_str_len) Z_PARAM_STRING_OR_NULL(pattern_str, pattern_str_len)
ZEND_PARSE_PARAMETERS_END_EX(return FAILURE); ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
if (DATE_FORMAT_OBJECT(dfo) != NULL) { if (DATE_FORMAT_OBJECT(dfo) != NULL) {
@ -189,7 +194,7 @@ error:
U_CFUNC PHP_FUNCTION( datefmt_create ) U_CFUNC PHP_FUNCTION( datefmt_create )
{ {
object_init_ex( return_value, IntlDateFormatter_ce_ptr ); object_init_ex( return_value, IntlDateFormatter_ce_ptr );
if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, NULL, NULL) == FAILURE) {
zval_ptr_dtor(return_value); zval_ptr_dtor(return_value);
RETURN_NULL(); RETURN_NULL();
} }
@ -200,18 +205,20 @@ U_CFUNC PHP_FUNCTION( datefmt_create )
U_CFUNC PHP_METHOD( IntlDateFormatter, __construct ) U_CFUNC PHP_METHOD( IntlDateFormatter, __construct )
{ {
zend_error_handling error_handling; zend_error_handling error_handling;
bool error_handling_replaced = 0;
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
/* return_value param is being changed, therefore we will always return /* return_value param is being changed, therefore we will always return
* NULL here */ * NULL here */
return_value = ZEND_THIS; return_value = ZEND_THIS;
if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (datefmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_string *err = intl_error_get_message(NULL); zend_string *err = intl_error_get_message(NULL);
zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL)); zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL));
zend_string_release_ex(err, 0); zend_string_release_ex(err, 0);
} }
} }
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }
/* }}} */ /* }}} */

View file

@ -30,7 +30,7 @@ using icu::DateTimePatternGenerator;
using icu::Locale; using icu::Locale;
using icu::StringPiece; using icu::StringPiece;
static zend_result dtpg_ctor(INTERNAL_FUNCTION_PARAMETERS) static zend_result dtpg_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
char *locale_str; char *locale_str;
size_t locale_len = 0; size_t locale_len = 0;
@ -44,6 +44,11 @@ static zend_result dtpg_ctor(INTERNAL_FUNCTION_PARAMETERS)
Z_PARAM_STRING_OR_NULL(locale_str, locale_len) Z_PARAM_STRING_OR_NULL(locale_str, locale_len)
ZEND_PARSE_PARAMETERS_END_EX(return FAILURE); ZEND_PARSE_PARAMETERS_END_EX(return FAILURE);
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
DTPATTERNGEN_METHOD_FETCH_OBJECT_NO_CHECK; DTPATTERNGEN_METHOD_FETCH_OBJECT_NO_CHECK;
if (dtpgo->dtpg != NULL) { if (dtpgo->dtpg != NULL) {
@ -74,7 +79,7 @@ static zend_result dtpg_ctor(INTERNAL_FUNCTION_PARAMETERS)
U_CFUNC PHP_METHOD( IntlDatePatternGenerator, create ) U_CFUNC PHP_METHOD( IntlDatePatternGenerator, create )
{ {
object_init_ex( return_value, IntlDatePatternGenerator_ce_ptr ); object_init_ex( return_value, IntlDatePatternGenerator_ce_ptr );
if (dtpg_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (dtpg_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, NULL, NULL) == FAILURE) {
zval_ptr_dtor(return_value); zval_ptr_dtor(return_value);
RETURN_NULL(); RETURN_NULL();
} }
@ -83,19 +88,21 @@ U_CFUNC PHP_METHOD( IntlDatePatternGenerator, create )
U_CFUNC PHP_METHOD( IntlDatePatternGenerator, __construct ) U_CFUNC PHP_METHOD( IntlDatePatternGenerator, __construct )
{ {
zend_error_handling error_handling; zend_error_handling error_handling;
bool error_handling_replaced = 0;
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
/* return_value param is being changed, therefore we will always return /* return_value param is being changed, therefore we will always return
* NULL here */ * NULL here */
return_value = ZEND_THIS; return_value = ZEND_THIS;
if (dtpg_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (dtpg_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_string *err = intl_error_get_message(NULL); zend_string *err = intl_error_get_message(NULL);
zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL)); zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL));
zend_string_release_ex(err, 0); zend_string_release_ex(err, 0);
} }
} }
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }

View file

@ -23,7 +23,7 @@
#include "intl_convert.h" #include "intl_convert.h"
/* {{{ */ /* {{{ */
static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
const char* locale; const char* locale;
char* pattern = NULL; char* pattern = NULL;
@ -40,6 +40,11 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
return FAILURE; return FAILURE;
} }
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len); INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len);
object = return_value; object = return_value;
FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK; FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK;
@ -74,7 +79,7 @@ static int numfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
PHP_FUNCTION( numfmt_create ) PHP_FUNCTION( numfmt_create )
{ {
object_init_ex( return_value, NumberFormatter_ce_ptr ); object_init_ex( return_value, NumberFormatter_ce_ptr );
if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, NULL, NULL) == FAILURE) {
zval_ptr_dtor(return_value); zval_ptr_dtor(return_value);
RETURN_NULL(); RETURN_NULL();
} }
@ -85,15 +90,17 @@ PHP_FUNCTION( numfmt_create )
PHP_METHOD( NumberFormatter, __construct ) PHP_METHOD( NumberFormatter, __construct )
{ {
zend_error_handling error_handling; 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; return_value = ZEND_THIS;
if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (numfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
} }
} }
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }
/* }}} */ /* }}} */

View file

@ -25,7 +25,7 @@
#include "intl_convert.h" #include "intl_convert.h"
/* {{{ */ /* {{{ */
static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS) static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
const char* locale; const char* locale;
char* pattern; char* pattern;
@ -45,6 +45,11 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
return FAILURE; return FAILURE;
} }
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len); INTL_CHECK_LOCALE_LEN_OR_FAILURE(locale_len);
MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK; MSG_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
@ -104,7 +109,7 @@ static int msgfmt_ctor(INTERNAL_FUNCTION_PARAMETERS)
PHP_FUNCTION( msgfmt_create ) PHP_FUNCTION( msgfmt_create )
{ {
object_init_ex( return_value, MessageFormatter_ce_ptr ); object_init_ex( return_value, MessageFormatter_ce_ptr );
if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, NULL, NULL) == FAILURE) {
zval_ptr_dtor(return_value); zval_ptr_dtor(return_value);
RETURN_NULL(); RETURN_NULL();
} }
@ -115,17 +120,19 @@ PHP_FUNCTION( msgfmt_create )
PHP_METHOD( MessageFormatter, __construct ) PHP_METHOD( MessageFormatter, __construct )
{ {
zend_error_handling error_handling; 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; return_value = ZEND_THIS;
if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (msgfmt_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_string *err = intl_error_get_message(NULL); zend_string *err = intl_error_get_message(NULL);
zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL)); zend_throw_exception(IntlException_ce_ptr, ZSTR_VAL(err), intl_error_get_code(NULL));
zend_string_release_ex(err, 0); zend_string_release_ex(err, 0);
} }
} }
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }
/* }}} */ /* }}} */

View file

@ -74,7 +74,7 @@ static zend_object *ResourceBundle_object_create( zend_class_entry *ce )
/* }}} */ /* }}} */
/* {{{ ResourceBundle_ctor */ /* {{{ ResourceBundle_ctor */
static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS) static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handling *error_handling, bool *error_handling_replaced)
{ {
const char *bundlename; const char *bundlename;
size_t bundlename_len = 0; size_t bundlename_len = 0;
@ -93,6 +93,11 @@ static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
return FAILURE; return FAILURE;
} }
if (error_handling != NULL) {
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, error_handling);
*error_handling_replaced = 1;
}
if (rb->me) { if (rb->me) {
zend_throw_error(NULL, "ResourceBundle object is already constructed"); zend_throw_error(NULL, "ResourceBundle object is already constructed");
return FAILURE; return FAILURE;
@ -139,15 +144,17 @@ static int resourcebundle_ctor(INTERNAL_FUNCTION_PARAMETERS)
PHP_METHOD( ResourceBundle, __construct ) PHP_METHOD( ResourceBundle, __construct )
{ {
zend_error_handling error_handling; 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; return_value = ZEND_THIS;
if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, &error_handling, &error_handling_replaced) == FAILURE) {
if (!EG(exception)) { if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0); zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);
} }
} }
zend_restore_error_handling(&error_handling); if (error_handling_replaced) {
zend_restore_error_handling(&error_handling);
}
} }
/* }}} */ /* }}} */
@ -155,7 +162,7 @@ PHP_METHOD( ResourceBundle, __construct )
PHP_FUNCTION( resourcebundle_create ) PHP_FUNCTION( resourcebundle_create )
{ {
object_init_ex( return_value, ResourceBundle_ce_ptr ); object_init_ex( return_value, ResourceBundle_ce_ptr );
if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU) == FAILURE) { if (resourcebundle_ctor(INTERNAL_FUNCTION_PARAM_PASSTHRU, NULL, NULL) == FAILURE) {
zval_ptr_dtor(return_value); zval_ptr_dtor(return_value);
RETURN_NULL(); RETURN_NULL();
} }

View file

@ -0,0 +1,40 @@
--TEST--
GH-8115 (Can't catch deprecation in IntlDateFormatter)
--EXTENSIONS--
intl
--FILE--
<?php
error_reporting(E_ALL);
set_error_handler(function ($errNo, $errStr) {
echo "Caught ($errNo): $errStr\n";
});
try {
new \IntlDateFormatter(null, null, null);
} catch (\IntlException) {}
try {
new \IntlRuleBasedBreakIterator(null, null);
} catch (\IntlException) {}
// Can't be tested since all params are optional
new \IntlGregorianCalendar(null, null);
new \Collator(null);
// Can't be tested since all params are optional
new \IntlDatePatternGenerator(null);
new \NumberFormatter(null, null);
try {
new \MessageFormatter(null, null);
} catch (\IntlException) {}
new \ResourceBundle(null, null, null);
?>
--EXPECT--
Caught (8192): IntlDateFormatter::__construct(): Passing null to parameter #2 ($dateType) of type int is deprecated
Caught (8192): IntlDateFormatter::__construct(): Passing null to parameter #3 ($timeType) of type int is deprecated
Caught (8192): IntlRuleBasedBreakIterator::__construct(): Passing null to parameter #1 ($rules) of type string is deprecated
Caught (8192): IntlRuleBasedBreakIterator::__construct(): Passing null to parameter #2 ($compiled) of type bool is deprecated
Caught (8192): Collator::__construct(): Passing null to parameter #1 ($locale) of type string is deprecated
Caught (8192): NumberFormatter::__construct(): Passing null to parameter #1 ($locale) of type string is deprecated
Caught (8192): NumberFormatter::__construct(): Passing null to parameter #2 ($style) of type int is deprecated
Caught (8192): MessageFormatter::__construct(): Passing null to parameter #1 ($locale) of type string is deprecated
Caught (8192): MessageFormatter::__construct(): Passing null to parameter #2 ($pattern) of type string is deprecated
Caught (8192): ResourceBundle::__construct(): Passing null to parameter #3 ($fallback) of type bool is deprecated