#13142 [Com]: strtotime() returns -1 for "M d H:i:s Y" format
| From: | fh at fuenf-freun dot de | Date: | Sat, 19 Apr 2003 21:49:44 +0000 |
| Subject: | #13142 [Com]: strtotime() returns -1 for "M d H:i:s Y" format | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-37912@lists.php.net to get a copy of this message | ||
ID: 13142
Comment by: fh at fuenf-freun dot de
Reported By: jeannielu at hotmail dot com
Status: Verified
Bug Type: Date/time related
Operating System: Linux
PHP Version: 4.3.0-dev
New Comment:
The problem is that the argument is ambigous.
"M d H:i:s Y"
could also be interpreted as
"M d Y:i:s Y".
The latter case happens when PHP parses the string. Then a parse error
occurs, because ':i:s' doesn't make any sense. Therefore, the function
returns -1.
In ext/standard/parsedate.y, the expression "M d H:i:s Y" is matched by
'tUNUMBER tMONTH tUNUMBER' (M d H) as well as 'tUNUMBER : tUNUMBER :
tUNUMBER' (H:i:s).
Unfortunately, I am not able to submit a patch as I know nothing about
lex/yacc.
Frederik
Previous Comments:
------------------------------------------------------------------------
[2003-04-07 14:40:20] jparneodo at yahoo dot fr
Same problem on RedHat 7.2
with PHP 4.3.0
on CEST timezone
returns -1
------------------------------------------------------------------------
[2003-01-02 19:34:21] nicos@php.net
Verified again with 4.3.0.
------------------------------------------------------------------------
[2002-10-11 09:13:55] godin dot gilles at ic dot gc dot ca
I am using PHP 4.2.3 under Windows 2000 where
date("D M d H:i:s T Y") produces...
Fri Oct 11 09:52:47 Eastern Standard Time 2002
instead of...
Fri Oct 11 09:52:47 EDT 2002
and, strtotime() of either format produced above returns -1
------------------------------------------------------------------------
[2002-07-04 13:22:32] eru@php.net
Verified during the Bughunt
------------------------------------------------------------------------
[2001-09-04 20:15:24] sniper@php.net
Uh..reproduced I meant. :)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/13142
--
Edit this bug report at http://bugs.php.net/?id=13142&edit=1