#43808 [Opn->Asn]: date_create never fails (even when it should)
| From: | tony2001@php.net | Date: | Sat, 12 Jan 2008 15:26:38 +0000 |
| Subject: | #43808 [Opn->Asn]: date_create never fails (even when it should) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-121217@lists.php.net to get a copy of this message | ||
ID: 43808
Updated by: tony2001@php.net
Reported By: martin dot contento at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: linux
PHP Version: 5.2.5
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2008-01-10 18:30:37] martin dot contento at gmail dot com
Description:
------------
As "karsten" already mentioned
(http://de.php.net/manual/en/function.date-create.php#77871)
date_create() never returns FALSE like it is supposed to, even when it
is handed complete garbage. It seems to be something like "if the string
starts with a letter, treat it as a timezone -> this is not a timezone
*dies*)
edit:
also, this bug might be related: http://bugs.php.net/bug.php?id=40340
Reproduce code:
---------------
<?php
$date = date_create('asdfasdf');
if ($date instanceof DateTime {
echo "this is wrong, should be bool";
}
?>
Expected result:
----------------
nothing (i would expect date_create() to handle the error in the
timezone function and return FALSE)
Actual result:
--------------
Warning: date_create(): Failed to parse time string (asdfasdf) at
position 0 (a): The timezone could not be found in the database in
/home/mcontento/datetimebug.php on line 3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43808&edit=1