|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-09-29 15:56 UTC] vascowhite at gmail dot com
[2013-09-29 22:46 UTC] requinix@php.net
-Status: Open
+Status: Duplicate
[2013-09-29 22:46 UTC] requinix@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 06:00:01 2025 UTC |
Description: ------------ If just a single letter is passed to the constructor of \DateTime it is accepted as a valid timezone string. Except, for some strange reason, the letter 'j'. Test script: --------------- $date = new \DateTime('a'); var_dump($date); Expected result: ---------------- I expect an exception to be raised with the message:- Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (a) at position 0 (a): The timezone could not be found in the database' Actual result: -------------- Except for when the letter 'j' is passed a DateTime object is created. For example the following code:- $date = new \DateTime('a'); var_dump($date); Will give the following output:- object(DateTime)[1] public 'date' => string '2013-09-29 15:17:19' (length=19) public 'timezone_type' => int 2 public 'timezone' => string 'A' (length=1) Where it should raise an exception.