|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-12-17 20:24 UTC] geekcom@php.net
-Assigned To:
+Assigned To: geekcom
[2019-12-17 20:24 UTC] geekcom@php.net
-Assigned To: geekcom
+Assigned To:
[2019-12-17 23:12 UTC] carusogabriel@php.net
[2020-01-20 17:09 UTC] girgias@php.net
-Assigned To:
+Assigned To: derick
[2020-02-20 08:06 UTC] a at b dot c dot de
[2021-08-18 19:31 UTC] derick@php.net
[2021-08-19 15:08 UTC] derick@php.net
-Status: Assigned
+Status: Closed
[2021-08-19 15:08 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 04:00:01 2025 UTC |
Description: ------------ Today, object \DateTimeZone accepts various timezone format in your construct. One option to instantiate this is using UTC formats like "-3" or "+5", but today UTC have only timezone between -12 and +12 and construct is accepting any number, like in test script. Expected result if you define invalid UTC timezone is fatal error, like when you set other unknown or bad timezone, as described in php_date.c#L3484, but today this object is accepting any integer value and causes mistakes in date time operations. Test script: --------------- <?php var_dump( new \DateTimeZone('-3'), new \DateTimeZone('+3'), new \DateTimeZone('+30157') ); Expected result: ---------------- Fatal error: Uncaught Exception: DateTimeZone::__construct(): Unknown or bad timezone (+30157) in %script% Actual result: -------------- object(DateTimeZone)#1 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "-03:00" } object(DateTimeZone)#2 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:00" } object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(9) "+30157eZ" }