|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-06-11 06:41 UTC] requinix@php.net
[2019-06-12 17:31 UTC] baby-luck at earthling dot net
[2020-01-20 17:18 UTC] girgias@php.net
-Assigned To:
+Assigned To: derick
[2022-05-20 15:24 UTC] derick@php.net
[2022-05-27 13:44 UTC] git@php.net
[2022-05-27 13:44 UTC] git@php.net
-Status: Assigned
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 03:00:02 2025 UTC |
Description: ------------ timezone_open() accepts undocumented/nonsense/partial timezones. The docs say "One of the supported timezone names or an offset value" but accepts seemingly nonsense timezones without failure, and timezones found in the first non-whitespace block in the argument string. Test script: --------------- $tz = timezone_open("x UTC"); echo '"x UTC" = '; var_dump($tz); $tz = timezone_open("c"); echo '"c" = '; var_dump($tz); $tz = timezone_open("xx UTC"); echo '"xx UTC" = '; var_dump($tz); $tz = timezone_open("xUTC"); echo '"xUTC" = '; var_dump($tz); $tz = timezone_open("UTCx"); echo '"UTCx" = '; var_dump($tz); $tz = timezone_open("UTC xx"); echo '"UTC xx" = '; var_dump($tz); Expected result: ---------------- "x UTC" = bool(false) "c" = bool(false) "xx UTC" = bool(false) "xUTC" = bool(false) "UTCx" = bool(false) "UTC xx" = bool(false) Actual result: -------------- "x UTC" = object(DateTimeZone)#127 (2) { ["timezone_type"]=> int(2) ["timezone"]=> string(1) "X" } "c" = object(DateTimeZone)#128 (2) { ["timezone_type"]=> int(2) ["timezone"]=> string(1) "C" } "xx UTC" = bool(false) "xUTC" = bool(false) "UTCx" = bool(false) "UTC xx" = object(DateTimeZone)#128 (2) { ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }