ID: 30215 Updated by: [EMAIL PROTECTED] Reported By: pmurray at nevada dot net dot nz -Status: Feedback +Status: Bogus Bug Type: Date/time related Operating System: Linux 64bit - Opteron PHP Version: 5.*, 4.* Assigned To: derick New Comment:
. Previous Comments: ------------------------------------------------------------------------ [2005-06-30 08:26:01] [EMAIL PROTECTED] How would you fix it, it's not broken... it merely does something you don't expect. strtotime() is supposed to take a string describing an english date, not a timestamp. ------------------------------------------------------------------------ [2005-06-30 02:45:42] pmurray at nevada dot net dot nz Yes, it is indeed fixed in 5.1 CVS now. Is there any chance at all this will get a fix for people using PHP4 on 64bit? ------------------------------------------------------------------------ [2005-06-29 20:35:40] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Actually, after debugging this I would consider it as not a bug. What happens is the following: 1. time() returns (something like): 1120069874 2. parsetotime() sees this correctly as "number" 3. the number > 10000 so it applies the following rules: ((struct date_yy *)parm)->yyHaveDate++; ((struct date_yy *)parm)->yyDay= ($1)%100; ((struct date_yy *)parm)->yyMonth= ($1/100)%100; ((struct date_yy *)parm)->yyYear = $1/10000; 4. This turns out to be year 112006, month 98 and day 74. 5. The correct timestamp for this is: 3472662258000 Morale: Don't pass time()'s return value to strtotime() as it might "weird", though correct, behave. ------------------------------------------------------------------------ [2005-06-29 14:46:58] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip I just tested this on a 64bit platform, it returns bool(false) (like it should): [EMAIL PROTECTED] php5-200506291030]$ sapi/cli/php -r 'var_dump(strtotime(time()));' bool(false) ------------------------------------------------------------------------ [2005-06-27 15:24:22] arpad at zooloo dot com [EMAIL PROTECTED]: I'm not sure if this is related but beta2 on 32bit windows behaves a lot worse than beta1 did: echo strtotime(1118936460); results in 1119871080 which does not make sense. This worked perfectly with beta1. I have not yet tested this on my 64bit gentoo. ------------------------------------------------------------------------ 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/30215 -- Edit this bug report at http://bugs.php.net/?id=30215&edit=1
