Skip to content

Some intl tests fail due to narrow non-breaking spaces #10262

Closed
@nielsdos

Description

@nielsdos

Description

The following tests:

IntlDateFormatter, calendars and time zone [ext/intl/tests/dateformat_calendars_variant3.phpt]
IntlDateFormatter::create() with default date and time types [ext/intl/tests/dateformat_create_default.phpt]
IntlDateFormatter::formatObject(): IntlCalendar tests [ext/intl/tests/dateformat_formatObject_calendar_variant5.phpt]
IntlDateFormatter::formatObject(): DateTime tests [ext/intl/tests/dateformat_formatObject_datetime_variant5.phpt]
datefmt_format_code() and datefmt_parse_code() [ext/intl/tests/dateformat_format_parse_version2.phpt]
datefmt_set_timezone_id_code() icu >= 4.8 [ext/intl/tests/dateformat_set_timezone_id3.phpt]
IntlDatePatternGenerator::getBestPattern() [ext/intl/tests/datepatterngenerator_get_best_pattern.phpt]
MessageFormatter::format(): DateTime accepted to format dates and times [ext/intl/tests/msgfmt_format_datetime.phpt]
MessageFormatter::format(): simple types handling with numeric strings [ext/intl/tests/msgfmt_format_simple_types_numeric_strings.phpt]
ResourceBundle constructor bundle accepts NULL for first two arguments [ext/intl/tests/resourcebundle_null_mandatory_args_variant2.phpt]

Break on my system (INTL_ICU_VERSION == 72.1)

For example, ext/intl/tests/dateformat_calendars_variant3.phpt resulted in the following diff:

========DIFF========
001+ string(16) "h:mm:ss a zzzz"
001- string(14) "h:mm:ss a zzzz"
     string(13) "HH:mm:ss zzzz"
========DONE========

The reason the string is 16 long instead of 14 is because on my system the space between "a" and "zzzz" is a UTF-8 "NARROW NO-BREAK SPACE". A "NARROW NO-BREAK SPACE" is 3 bytes long which explains the difference.
This "NARROW NO-BREAK SPACE" is the root cause of all the failing tests I posted, and I've also seen this one happen on CI too.

PHP Version

8.1.14 and higher

Operating System

Linux 6.1.3

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions