mirror of
https://github.com/php/php-src.git
synced 2026-03-27 17:52:16 +01:00
- Fixed bug #37514 (strtotime doesn't assume year correctly).
This commit is contained in:
1
NEWS
1
NEWS
@@ -40,6 +40,7 @@ PHP NEWS
|
||||
- Added pg_field_table() function. (Edin)
|
||||
- Added implementation of curl_multi_info_read(). (Brian)
|
||||
- Added RFC2397 (data: stream) support. (Marcus)
|
||||
- Fixed bug #37514 (strtotime doesn't assume year correctly). (Derick)
|
||||
- Fixed bug #37510 (session_regenerate_id changes session_id() even on
|
||||
failure). (Hannes)
|
||||
- Fixed bug #37505 (touch() truncates large files). (Ilia)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -859,6 +859,8 @@ clf = day "/" monthabbr "/" year4 ":" hour24lz ":" minutelz ":" sec
|
||||
timestamp = "@" "-"? [0-9]+;
|
||||
|
||||
/* To fix some ambiguities */
|
||||
dateshortwithtimeshort12 = datenoyear timeshort12;
|
||||
dateshortwithtimelong12 = datenoyear timelong12;
|
||||
dateshortwithtimeshort = datenoyear timeshort24;
|
||||
dateshortwithtimelong = datenoyear timelong24;
|
||||
dateshortwithtimelongtz = datenoyear iso8601normtz;
|
||||
@@ -1403,6 +1405,30 @@ relativetext = reltextnumber space? reltextunit;
|
||||
return TIMELIB_TIMEZONE;
|
||||
}
|
||||
|
||||
dateshortwithtimeshort12 | dateshortwithtimelong12
|
||||
{
|
||||
DEBUG_OUTPUT("dateshortwithtimeshort12 | dateshortwithtimelong12");
|
||||
TIMELIB_INIT;
|
||||
TIMELIB_HAVE_DATE();
|
||||
s->time->m = timelib_get_month((char **) &ptr);
|
||||
s->time->d = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
TIMELIB_HAVE_TIME();
|
||||
s->time->h = timelib_get_nr((char **) &ptr, 2);
|
||||
s->time->i = timelib_get_nr((char **) &ptr, 2);
|
||||
if (*ptr == ':' || *ptr == '.') {
|
||||
s->time->s = timelib_get_nr((char **) &ptr, 2);
|
||||
|
||||
if (*ptr == '.') {
|
||||
s->time->f = timelib_get_frac_nr((char **) &ptr, 8);
|
||||
}
|
||||
}
|
||||
|
||||
s->time->h += timelib_meridian((char **) &ptr, s->time->h);
|
||||
TIMELIB_DEINIT;
|
||||
return TIMELIB_SHORTDATE_WITH_TIME;
|
||||
}
|
||||
|
||||
dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz
|
||||
{
|
||||
int tz_not_found;
|
||||
|
||||
20
ext/date/tests/bug37514.phpt
Normal file
20
ext/date/tests/bug37514.phpt
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #37514 (strtotime doesn't assume year correctly).
|
||||
--INI--
|
||||
date.timezone=UTC
|
||||
--FILE--
|
||||
<?php
|
||||
echo date('r', strtotime('May 18th 5:05')), "\n";
|
||||
echo date('r', strtotime('May 18th 5:05pm')), "\n";
|
||||
echo date('r', strtotime('May 18th 5:05 pm')), "\n";
|
||||
echo date('r', strtotime('May 18th 5:05am')), "\n";
|
||||
echo date('r', strtotime('May 18th 5:05 am')), "\n";
|
||||
echo date('r', strtotime('May 18th 2006 5:05pm')), "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
Thu, 18 May 2006 05:05:00 +0000
|
||||
Thu, 18 May 2006 17:05:00 +0000
|
||||
Thu, 18 May 2006 17:05:00 +0000
|
||||
Thu, 18 May 2006 05:05:00 +0000
|
||||
Thu, 18 May 2006 05:05:00 +0000
|
||||
Thu, 18 May 2006 17:05:00 +0000
|
||||
Reference in New Issue
Block a user