Browse Source

- Fixed bug #37514 (strtotime doesn't assume year correctly).

PECL_OPENSSL
Derick Rethans 20 years ago
parent
commit
ab8329ec31
  1. 1
      NEWS
  2. 12076
      ext/date/lib/parse_date.c
  3. 26
      ext/date/lib/parse_date.re
  4. 20
      ext/date/tests/bug37514.phpt

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)

12076
ext/date/lib/parse_date.c
File diff suppressed because it is too large
View File

26
ext/date/lib/parse_date.re

@ -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

@ -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
Loading…
Cancel
Save