#19165 [NEW]: strtotime does not return -1 on some invalid dates
| From: | jc at mega-bucks dot co dot jp | Date: | Thu, 29 Aug 2002 07:43:03 +0000 |
| Subject: | #19165 [NEW]: strtotime does not return -1 on some invalid dates | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-18125@lists.php.net to get a copy of this message | ||
From: jc@mega-bucks.co.jp
Operating system: Red Hat Linux 7.2
PHP version: 4.2.2
PHP Bug Type: Date/time related
Bug description: strtotime does not return -1 on some invalid dates
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 bug report at http://bugs.php.net/?id=19165&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19165&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19165&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19165&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19165&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19165&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19165&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19165&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19165&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19165&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19165&r=globals