Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ PHP NEWS
. Fixed bug GH-22825 (DOMElement::setAttribute() fails silently when the DTD
declares a default value for the attribute). (iliaal)

- Intl:
. Fixed IntlListFormatter::__construct() leaving stale global error state
after successful calls. (Weilin Du)

- Opcache:
. Fixed GH-22693 (DT_TEXTREL in JIT-generated TLS access on x86_64).
(David Carlier)
Expand Down
3 changes: 3 additions & 0 deletions ext/intl/listformatter/listformatter_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ PHP_METHOD(IntlListFormatter, __construct)
zend_long type = INTL_LISTFORMATTER_FALLBACK_TYPE_AND;
zend_long width = INTL_LISTFORMATTER_FALLBACK_WIDTH_WIDE;
#endif

intl_errors_reset(LISTFORMATTER_ERROR_P(obj));

ZEND_PARSE_PARAMETERS_START(1, 3)
Z_PARAM_STRING(locale, locale_len)
Z_PARAM_OPTIONAL
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
IntlListFormatter::__construct() resets stale errors
--EXTENSIONS--
intl
--FILE--
<?php
$formatter = new IntlListFormatter('en_US');
var_dump($formatter->format(["\x80"]));
var_dump(intl_get_error_code() === U_INVALID_CHAR_FOUND);

$formatter = new IntlListFormatter('en_US');
var_dump(intl_get_error_code());
var_dump(intl_get_error_message());
var_dump($formatter->getErrorCode());
var_dump($formatter->getErrorMessage());
?>
--EXPECT--
bool(false)
bool(true)
int(0)
string(12) "U_ZERO_ERROR"
int(0)
string(12) "U_ZERO_ERROR"
Loading