[php-src] Issue #11150: DateTimeImmutable::createFromFormat parses non-existing timezone offsets

From: Date: Fri, 28 Apr 2023 06:53:13 +0000
Subject: [php-src] Issue #11150: DateTimeImmutable::createFromFormat parses non-existing timezone offsets
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244293@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11150 Author: dbertovi ### Description The following code: ```php <?php //OK Example: $time = '2023-02-22T19:44:42.85857+05:30'; $date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s.uP', $time); echo $date->format('P'); //OUTPUT = +05:30 //OK //BUG Example: $time = '2023-02-22 19:44:42.127801-110'; $date = DateTimeImmutable::createFromFormat('Y-m-d H:i:s.uP', $time); echo $date->format('P'); //OUTPUT = -01:10 //NOT OK, TIMEZONE OFFSET DOESN'T EXIST, must throw exception ``` But I expected this output instead: Fatal Error Shouldn't PHP check the proper existing time zone offset, when it already properly lists timezone identifiers (a.k.a. through DateTimeZone::listIdentifiers())? ### PHP Version PHP 8.0.28 ### Operating System LiteSpeed

« previous php.bugs (#244293) next »