Fixed bug #38229 (strtotime() does not parse YYYY-MM format).

This commit is contained in:
Ilia Alshanetsky 2006-07-27 13:00:00 +00:00
parent 92f4cc359f
commit af48ecfc87
4 changed files with 18524 additions and 18896 deletions

1
NEWS
View File

@ -16,6 +16,7 @@ PHP NEWS
compatibility issue). (Patch: scott dot moynes+php at gmail dot com)
- Fixed bug #38234 (Exception in __clone makes memory leak). (Dmitry, Nuno)
- Fixed bug #38229 (strtotime() does not parse YYYY-MM format). (Ilia)
- Fixed bug #38220 (Crash on some object operations). (Dmitry)
- Fixed bug #38217 (ReflectionClass::newInstanceArgs() tries to allocate too
much memory). (Tony)

File diff suppressed because it is too large Load Diff

View File

@ -829,6 +829,7 @@ americanshort = month "/" day;
american = month "/" day "/" year;
iso8601dateslash = year4 "/" monthlz "/" daylz "/"?;
dateslash = year4 "/" month "/" day;
gnudateshorter = year4 "-" month;
gnudateshort = year "-" month "-" day;
iso8601date = year4 "-" monthlz "-" daylz;
pointeddate = day [.\t-] month [.-] year;
@ -1094,6 +1095,18 @@ relativetext = reltextnumber space reltextunit;
return TIMELIB_ISO_DATE;
}
gnudateshorter
{
DEBUG_OUTPUT("gnudateshorter");
TIMELIB_INIT;
TIMELIB_HAVE_DATE();
s->time->y = timelib_get_nr((char **) &ptr, 4);
s->time->m = timelib_get_nr((char **) &ptr, 2);
TIMELIB_PROCESS_YEAR(s->time->y);
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
gnudateshort
{
DEBUG_OUTPUT("gnudateshort");

View File

@ -0,0 +1,13 @@
--TEST--
Bug #38229 (strtotime() does not parse YYYY-MM)
--FILE--
<?php
date_default_timezone_set("GMT");
echo date("Y-m", strtotime('2006-1'))."\n";
echo date("Y-m", strtotime('2006-03'))."\n";
echo date("Y-m", strtotime('2006-12'))."\n";
?>
--EXPECT--
2006-01
2006-03
2006-12