#19165 [Dup]: strtotime does not return -1 on some invalid dates
| From: | derick@php.net | Date: | Thu, 29 Aug 2002 12:35:08 +0000 |
| Subject: | #19165 [Dup]: strtotime does not return -1 on some invalid dates | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-18143@lists.php.net to get a copy of this message | ||
ID: 19165
Updated by: derick@php.net
Reported By: jc@mega-bucks.co.jp
Status: Duplicate
Bug Type: Date/time related
Operating System: Red Hat Linux 7.2
PHP Version: 4.2.2
New Comment:
Marking this as dup of 18101 instead, this beast needs rewriting :)
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-08-29 03:51:44] jc@mega-bucks.co.jp
Ok. Does this mean that strtotime() is *not* meant to pick up invalid
date inputs and fail on them?
------------------------------------------------------------------------
[2002-08-29 03:47:35] derick@php.net
I'm marking this as duplicate of 19166, because IMO this is a
documentation problem rather than a problem in the code.
Derick
------------------------------------------------------------------------
[2002-08-29 03:43:03] jc@mega-bucks.co.jp
This code shows that strtotime does not recognize some dates that are
in the correct format but invalid:
$bod = "1970-1-222";
echo "I think that $bod is timestamp " . strtotime($bod) . "<BR>";
echo "and that would be " . date("Y-n-d",strtotime($bod)).
"<BR>";
The output is:
I think that 1970-1-222 is timestamp 19062000
and that would be 1970-8-10
The documentation says that strtotime should report -1 on a failure.
Shouldn't this be a failure?
Jc
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19165&edit=1