|  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
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: 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-2020 The PHP Group
All rights reserved.
Last updated: Thu Aug 13 13:01:25 2020 UTC