[php-src] Issue #11600: strtotime returns false when string includes narrow non breaking space character
| From: | myleshyson | Date: | Wed, 05 Jul 2023 17:18:29 +0000 |
| Subject: | [php-src] Issue #11600: strtotime returns false when string includes narrow non breaking space character | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244886@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11600
Author: myleshyson
### Description
This is kind of related to #9799
With the [ICU 72.1 update](https://icu.unicode.org/download/72), it replaces a ascii space character
with a narrow non-breaking space unicode character for intl space So something like
```php
(new IntlDateFormatter('en_US', -1, 3))->getPattern();
```
will return
h:mm\u202fa instead of h:mm a.
When creating date strings based off that pattern with the NNBS character, and then passing into
strtotime, strtotime returns false.
With the ICU update, I think functions like strtotime should support parsing the NNBS
character.
The following code:
```php
<?php
$pattern = (new IntlDateFormatter('en_US', -1, 3))->getPattern();
$timeString = date($pattern, date('now'));
$timestamp = strtotime($timeString);
```
Resulted in this output:
```
false
```
But I expected this output instead:
```
a unix timestamp
```
### PHP Version
8.2.8
### Operating System
Redhat Enterprise 8.8