From: km at somehowbythesea dot org dot uk
Operating system: Linux
PHP version: 5.1.0
PHP Bug Type: Date/time related
Bug description: strtotime no longer working with ordinal suffix
Description:
------------
In PHP4.3, strtotime() will parse days of the month with and ordinal
suffix, in the format "Sat 26th Nov 2005 18:18", however this is no longer
possible in PHP5.1. The same string without the ordinal suffix ("Sat 26 Nov
2005 18:18") returns a timestamp as expected.
I apologize in advance if this should now be listed as a feature request
instead of a bug. In version 4.0.5 this problem was reported as a bug
(#15210) when in fact the parsing of ordinals was not actually a feature
at the time. Following that, the feature was added in CVS and was still
working at version 4.3.
Reproduce code:
---------------
<?
$tWithOrd = "Sat 26th Nov 2005 18:18";
$tWithoutOrd = "Sat 26 Nov 2005 18:18";
$UtimeWithOrd = strtotime($tWithOrd);
$UtimeWithoutOrd = strtotime($tWithoutOrd);
print("time string with ordinal suffix: $tWithOrd<br>");
print("time string without ordinal suffix: $tWithoutOrd<br><br>");
print("UNIX timestamp from time string with ordinal suffix:
$UtimeWithOrd<br>");
print("UNIX timestamp from time string without ordinal suffix:
$UtimeWithoutOrd<br><br>");
?>
Expected result:
----------------
Both variables $UtimeWithOrd and $UtimeWithoutOrd should contain a UNIX
timestamp, printing it to screen with the last two lines.
Actual result:
--------------
Only the variable $UtimeWithoutOrd contains a timestamp. $UtimeWithOrd is
empty and prints nothing.
--
Edit bug report at http://bugs.php.net/?id=35414&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=35414&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=35414&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=35414&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=35414&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=35414&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=35414&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=35414&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=35414&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35414&r=support
Expected behavior: http://bugs.php.net/fix.php?id=35414&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=35414&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=35414&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=35414&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35414&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=35414&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=35414&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35414&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=35414&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=35414&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=35414&r=mysqlcfg