[php-src] Issue #20406: Date parser does'nt speak ISO weekdates
| From: | hgshoggins | Date: | Thu, 06 Nov 2025 16:19:08 +0000 |
| Subject: | [php-src] Issue #20406: Date parser does'nt speak ISO weekdates | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251186@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20406
Author: hgshoggins
### Description
The following code:
```php
<?php
$dateTimeObj_monday = new DateTimeImmutable('2022W1', new
DateTimeZone('Europe/Paris'));
```
Resulted in this output:
```
PHP Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (2022W1) at
position 5 (1): Unexpected character in test.php:7
Stack trace:
#0 /root/test.php(7): DateTimeImmutable->__construct()
```
But I expected this output instead: a correctly set DateTimeImmutable object.
It seems that the parser refuses to recognize the "W" for week specification.
### PHP Version
```plain
PHP 8.4.14 (cli) (built: Oct 21 2025 19:23:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Fedora Project
Zend Engine v4.4.14, Copyright (c) Zend Technologies
```
### Operating System
Fedora 42