#35414 [Csd->Opn]: strtotime() no longer works with ordinal suffix
| From: | km at somehowbythesea dot org dot uk | Date: | Thu, 05 Jan 2006 06:45:51 +0000 |
| Subject: | #35414 [Csd->Opn]: strtotime() no longer works with ordinal suffix | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91522@lists.php.net to get a copy of this message | ||
ID: 35414
User updated by: km at somehowbythesea dot org dot uk
Reported By: km at somehowbythesea dot org dot uk
-Status: Closed
+Status: Open
Bug Type: Date/time related
Operating System: Linux
-PHP Version: 5.1.0
+PHP Version: 5.1.1
Assigned To: derick
New Comment:
The strtotime function still fails to produce a UNIX timestamp from
strings where the date - a number with it's ordinal suffix - precedes
the month.
For example, "Sat Nov 26th 2005 18:18" will produce a timestamp but
"Sat 26th Nov 2005 18:18" will not.
Previous Comments:
------------------------------------------------------------------------
[2005-11-29 02:23:41] iliaa@php.net
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.
------------------------------------------------------------------------
[2005-11-26 22:16:26] tony2001@php.net
Assigned to the author.
------------------------------------------------------------------------
[2005-11-26 22:12:43] km at somehowbythesea dot org dot uk
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 this bug report at http://bugs.php.net/?id=35414&edit=1