|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61311 provide a way to enable exceptions for all warning in DateTime class
Submitted: 2012-03-07 05:28 UTC Modified: -
Avg. Score:5.0 ± 0.0
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:3 (50.0%)
From: icedglow at email dot it Assigned:
Status: Open Package: Date/time related
PHP Version: 5.4.0 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: icedglow at email dot it
New email:
PHP Version: OS:


 [2012-03-07 05:28 UTC] icedglow at email dot it

$a = DateTime::createFromFormat("H:i", "1:1");

doesn't create the istance because minutes part require two digits

but this code doesn't produce a php warning or notice, even an exception, none at 

it returns false, but it is a constructor...

so why I need to use the if(), when I'm in a try{} block?

I was thinking that php's new way was "converting to OOP".


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-29 21:44 UTC] kavi at postpro dot net
The statement in the example 'works' in 5.3.3.

Here's what I'm using in my unit test for the presence of this bug:

$a = DateTime::createFromFormat('H:i:s', 'asdf');  // should throw Exception

The statement actually returns false and does not throw an exception.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Apr 13 17:01:24 2021 UTC