From:             chkp45 at hotmail dot com
Operating system: Linux
PHP version:      4.3.4
PHP Bug Type:     Date/time related
Bug description:  strtotime returns -1 randomly

Description:
------------
I read data from mssql server and get dates as "Feb 02 2004 12:00AM". I
read several dates in a loop, and for some dates  strtotime returns -1
occasionally, seemingly at random. When I refresh, the wrong result
changes to another date.

$d1 = strtotime($v["date"]);
printf("%s %s<br>", $v["date"], $d1); 

run 1:
Feb 02 2004 12:00AM 1075672800
Feb 03 2004 12:00AM -1
Feb 04 2004 12:00AM 1075845600
Feb 05 2004 12:00AM 1075932000
Feb 06 2004 12:00AM 1076018400
Feb 09 2004 12:00AM 1076277600
Feb 10 2004 12:00AM -1

run2:
Feb 02 2004 12:00AM -1
Feb 03 2004 12:00AM 1075759200
Feb 04 2004 12:00AM 1075845600
Feb 05 2004 12:00AM 1075932000
Feb 06 2004 12:00AM 1076018400
Feb 09 2004 12:00AM 1076277600
Feb 10 2004 12:00AM 1076364000

run3:
May 05 2003 12:00AM 1052082000
May 06 2003 12:00AM -1
May 07 2003 12:00AM 1052254800
May 08 2003 12:00AM 1052341200
May 09 2003 12:00AM 1052427600
May 12 2003 12:00AM 1052686800
May 13 2003 12:00AM 1052773200
May 14 2003 12:00AM 1052859600
May 15 2003 12:00AM 1052946000
May 16 2003 12:00AM 1053032400
May 19 2003 12:00AM 1053291600
May 20 2003 12:00AM 1053378000
May 21 2003 12:00AM 1053464400
May 21 2003 12:00AM -1
May 21 2003 12:00AM -1
May 22 2003 12:00AM 1053550800
May 23 2003 12:00AM 1053637200
May 26 2003 12:00AM 1053896400
May 27 2003 12:00AM 1053982800
May 27 2003 12:00AM 1053982800
May 27 2003 12:00AM 1053982800
May 28 2003 12:00AM 1054069200
May 28 2003 12:00AM 1054069200
May 30 2003 12:00AM 1054242000
May 30 2003 12:00AM 1054242000

This happened when I tested code in Fedora Linux 1, Apache 1.3.29 PHP
4.3.4.
Production version works ok on W2K Apache PHP 4.3.3.

On W2K date strings don't have leading zeros, eg 
"Feb 2 2004 12:00AM"



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

Reply via email to