|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67324 DateTime::createFromFormat wrong result
Submitted: 2014-05-22 11:42 UTC Modified: 2014-05-22 21:48 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: volny dot licvin at gmail dot com Assigned:
Status: Wont fix Package: Date/time related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: volny dot licvin at gmail dot com
New email:
PHP Version: OS:


 [2014-05-22 11:42 UTC] volny dot licvin at gmail dot com
DateTime::createFromFormat not checking properly provided format (day [01-31] and month [01-12] limitations) and only checking number of digits. 

Test script:
var_dump(DateTime::createFromFormat('Y-m-d', '9999-99-99'));

Expected result:

Actual result:
object(DateTime)#9 (3) {
  string(20) "10007-06-07 13:28:21"
  string(13) "Europe/Berlin"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-22 21:48 UTC]
-Status: Open +Status: Wont fix -Package: *General Issues +Package: Date/time related
 [2014-05-22 21:48 UTC]
createFromFormat(), like other functions that parse free text date strings, will wrap out of range values rather than generating errors, so long as they match the expected format (in terms of number of digits).
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Mar 26 13:03:48 2023 UTC