From:             info at peter-thomassen dot de
Operating system: any
PHP version:      Irrelevant
PHP Bug Type:     Date/time related
Bug description:  strtotime() should return false instead of -1 on failure

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 bug report at http://bugs.php.net/?id=29879&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=29879&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=29879&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=29879&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=29879&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=29879&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=29879&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=29879&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=29879&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=29879&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=29879&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=29879&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=29879&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=29879&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=29879&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=29879&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=29879&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=29879&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=29879&r=float

Reply via email to