#29879 [Opn->WFx]: strtotime() should return false instead of -1 on failure
| From: | iliaa@php.net | Date: | Sun, 29 Aug 2004 17:01:49 +0000 |
| Subject: | #29879 [Opn->WFx]: strtotime() should return false instead of -1 on failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65421@lists.php.net to get a copy of this message | ||
ID: 29879
Updated by: iliaa@php.net
Reported By: info at peter-thomassen dot de
-Status: Open
+Status: Wont fix
Bug Type: Date/time related
Operating System: any
PHP Version: Irrelevant
New Comment:
This change would break backwards compatibility.
Previous Comments:
------------------------------------------------------------------------
[2004-08-29 00:50:56] info at peter-thomassen dot de
Description:
------------
If an invalid time is specified, strtotime() returns -1.
Because -1 is ambiguous (it could also mean 1969-12-31
23:59:59 UTC), I request to return (bool)false on failure.
BTW:
http://www.gnu.org/software/tar/manual/html_chapter/tar_7.html#SEC117
which is mentioned in the docs allows a number preceded by
an '@' for the time argument to represent seconds since
the epoch. This results in an error -- shall I report
another bug for that?
Thanks!
Reproduce code:
---------------
<?php
var_dump(strtotime('invalid'));
?>
Expected result:
----------------
bool(false)
Actual result:
--------------
int(-1)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29879&edit=1