php.net |  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: -
Votes:6
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:
Have you experienced this issue?
Rate the importance of this bug to you:

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

$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 
all

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".


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 14:01:50 2014 UTC