Bug #53542 [Fbk->Csd]: DateTime raises a Warning when passed an incorrect date string

From: Date: Tue, 14 Dec 2010 14:08:54 +0000
Subject: Bug #53542 [Fbk->Csd]: DateTime raises a Warning when passed an incorrect date string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-156994@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53542&edit=1 ID: 53542 User updated by: jeremycook0 at gmail dot com Reported by: jeremycook0 at gmail dot com Summary: DateTime raises a Warning when passed an incorrect date string -Status: Feedback +Status: Closed Type: Bug Package: Date/time related Operating System: Windows 7 PHP Version: 5.3.4 Block user comment: N Private report: N New Comment: Thanks for the reply Derick. I think this was a false alarm. I'm using the dbg debugging extension and it seems that having the option 'debugger.JIT_enabled=on' causes this problem. Once I changed this setting to off the problem didn't occur. I'll bring this up with NuSphere. Sorry to waste your time, Jeremy. Previous Comments: ------------------------------------------------------------------------ [2010-12-14 00:31:40] derick@php.net I get the normal exception: $ php <?php $data= new DateTime('foo'); ?> PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (foo) at position 0 (f): The timezone could not be found in the database' in -:2 Stack trace: #0 -(2): DateTime->__construct('foo') #1 {main} thrown in - on line 2 Which warning are you getting? ------------------------------------------------------------------------ [2010-12-13 21:46:20] jeremycook0 at gmail dot com Description: ------------ Since upgrading to PHP 5.3.4 I'm finding that DateTime::__construct() emits an error of level E_WARNING instead of an Exception when passed an invalid date/time string. Test script: --------------- $date = new DateTime('foo'); Expected result: ---------------- An Exception should be raised. Actual result: -------------- An error of level E_WARNING. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53542&edit=1

« previous php.bugs (#156994) next »