ID: 34771 Updated by: [EMAIL PROTECTED] Reported By: arpad at rajeczy dot com -Status: Assigned +Status: Closed Bug Type: Date/time related Operating System: Windows XP PHP Version: 5.1.0RC1 Assigned To: derick New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2005-10-07 09:21:22] [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 ------------------------------------------------------------------------ [2005-10-07 04:30:52] arpad at rajeczy dot com Description: ------------ strtotime() now returns false for input like '12am', where the minutes are omitted with am, pm, a.m. or p.m. This should be allowed according to the GNU date input formats: http://www.gnu.org/software/tar/manual/html_chapter/tar_7.html#SEC112 It works correctly in 4.3.10, 4.4.0 and 5.0.4. It fails in 5.1.0RC1, built Aug 16 2005 13:49:49 and 5.1.0RC2-dev, built Oct 6 2005 20:17:56. Reproduce code: --------------- <pre><?php $tests = array( '12am', '1am', '1pm', '12a.m.', '1a.m.', '1p.m.', '12:00am', '1:00am', '1:00pm', '12:00a.m.', '1:00a.m.', '1:00p.m.' ); foreach ($tests as $test) { $t = strtotime($test); printf("%-10s => %-15s => %s\n", $test, var_export($t, 1), date('r', $t)); } ?></pre> Expected result: ---------------- 12am => 1128643200 => Fri, 07 Oct 2005 00:00:00 +0000 1am => 1128646800 => Fri, 07 Oct 2005 01:00:00 +0000 1pm => 1128690000 => Fri, 07 Oct 2005 13:00:00 +0000 12a.m. => 1128643200 => Fri, 07 Oct 2005 00:00:00 +0000 1a.m. => 1128646800 => Fri, 07 Oct 2005 01:00:00 +0000 1p.m. => 1128690000 => Fri, 07 Oct 2005 13:00:00 +0000 12:00am => 1128643200 => Fri, 07 Oct 2005 00:00:00 +0000 1:00am => 1128646800 => Fri, 07 Oct 2005 01:00:00 +0000 1:00pm => 1128690000 => Fri, 07 Oct 2005 13:00:00 +0000 12:00a.m. => 1128643200 => Fri, 07 Oct 2005 00:00:00 +0000 1:00a.m. => 1128646800 => Fri, 07 Oct 2005 01:00:00 +0000 1:00p.m. => 1128690000 => Fri, 07 Oct 2005 13:00:00 +0000 Actual result: -------------- 12am => false => Thu, 01 Jan 1970 00:00:00 +0000 1am => false => Thu, 01 Jan 1970 00:00:00 +0000 1pm => false => Thu, 01 Jan 1970 00:00:00 +0000 12a.m. => false => Thu, 01 Jan 1970 00:00:00 +0000 1a.m. => false => Thu, 01 Jan 1970 00:00:00 +0000 1p.m. => false => Thu, 01 Jan 1970 00:00:00 +0000 12:00am => 1128643200 => Fri, 07 Oct 2005 00:00:00 +0000 1:00am => 1128646800 => Fri, 07 Oct 2005 01:00:00 +0000 1:00pm => 1128690000 => Fri, 07 Oct 2005 13:00:00 +0000 12:00a.m. => 1128643200 => Fri, 07 Oct 2005 00:00:00 +0000 1:00a.m. => 1128646800 => Fri, 07 Oct 2005 01:00:00 +0000 1:00p.m. => 1128690000 => Fri, 07 Oct 2005 13:00:00 +0000 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34771&edit=1