[php-src] Issue #10262: Some intl tests fail due to narrow non-braking spaces
| From: | nielsdos | Date: | Sun, 08 Jan 2023 14:55:40 +0000 |
| Subject: | [php-src] Issue #10262: Some intl tests fail due to narrow non-braking spaces | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243368@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10262
Author: 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