diff --git a/NEWS b/NEWS index b01bb813ae7..f16a1f676c9 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,10 @@ PHP NEWS . Fixed bug GH-12232 (FPM: segfault dynamically loading extension without opcache). (Jakub Zelenka) +- Intl: + . Removed the BC break on IntlDateFormatter::construct which threw an + exception with an invalid locale. (David Carlier) + - Opcache: . Added warning when JIT cannot be enabled. (danog) . Fixed bug GH-8143 (Crashes in zend_accel_inheritance_cache_find since diff --git a/Zend/Optimizer/zend_inference.c b/Zend/Optimizer/zend_inference.c index d9ae75e1cdc..6d7dda58dd0 100644 --- a/Zend/Optimizer/zend_inference.c +++ b/Zend/Optimizer/zend_inference.c @@ -2545,6 +2545,7 @@ static zend_always_inline zend_result _zend_update_type_info( * code may assume that operands have at least one type. */ if (!(t1 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS)) || !(t2 & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS)) + || (ssa_op->result_use >= 0 && !(RES_USE_INFO() & (MAY_BE_ANY|MAY_BE_UNDEF|MAY_BE_CLASS))) || ((opline->opcode == ZEND_ASSIGN_DIM_OP || opline->opcode == ZEND_ASSIGN_OBJ_OP || opline->opcode == ZEND_ASSIGN_STATIC_PROP_OP diff --git a/ext/intl/dateformat/dateformat_create.cpp b/ext/intl/dateformat/dateformat_create.cpp index e14eb4f1a2f..5c96f41fadf 100644 --- a/ext/intl/dateformat/dateformat_create.cpp +++ b/ext/intl/dateformat/dateformat_create.cpp @@ -113,8 +113,7 @@ static zend_result datefmt_ctor(INTERNAL_FUNCTION_PARAMETERS, zend_error_handlin locale = Locale::createFromName(locale_str); /* get*Name accessors being set does not preclude being bogus */ if (locale.isBogus() || strlen(locale.getISO3Language()) == 0) { - intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "datefmt_create: invalid locale", 0); - return FAILURE; + goto error; } /* process calendar */ diff --git a/ext/intl/tests/gh12282.phpt b/ext/intl/tests/gh12282.phpt index 62d090ba616..a30899a08c7 100644 --- a/ext/intl/tests/gh12282.phpt +++ b/ext/intl/tests/gh12282.phpt @@ -5,17 +5,18 @@ intl --FILE-- getMessage(); -} +)); +Locale::setDefault('xx'); +var_dump(new IntlDateFormatter(Locale::getDefault())); --EXPECT-- -datefmt_create: invalid locale: U_ILLEGAL_ARGUMENT_ERROR +object(IntlDateFormatter)#1 (0) { +} +object(IntlDateFormatter)#1 (0) { +} diff --git a/ext/opcache/tests/opt/gh10008.phpt b/ext/opcache/tests/opt/gh10008.phpt new file mode 100644 index 00000000000..02f6feff9b0 --- /dev/null +++ b/ext/opcache/tests/opt/gh10008.phpt @@ -0,0 +1,26 @@ +--TEST-- +GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +--EXTENSIONS-- +opcache +--FILE-- + $bool_or_int, $string_key => 123]; + } + + $bool_or_int = 0; + } +} +?> +DONE +--EXPECT-- +DONE