From: EC2 Default User Date: Sun, 5 Aug 2012 17:14:51 +0000 (+0000) Subject: Bug #60774 (DateInterval::format("%a") is always zero when an interval is X-Git-Tag: php-5.5.0beta3~8^2~38 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b07ecb5501bcc07c830b552aee39098439fe2027;p=php Bug #60774 (DateInterval::format("%a") is always zero when an interval is created using the createFromDateString method) --- diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c index e8f393f322..9f5593dacb 100644 --- a/ext/date/lib/parse_date.c +++ b/ext/date/lib/parse_date.c @@ -24789,6 +24789,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container in.tzdb = tzdb; in.time->is_localtime = 0; in.time->zone_type = 0; + in.time->relative.days = TIMELIB_UNSET; do { t = scan(&in, tz_get_wrapper); diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re index f3f5906b0a..8aaa6c336e 100644 --- a/ext/date/lib/parse_date.re +++ b/ext/date/lib/parse_date.re @@ -1796,6 +1796,7 @@ timelib_time* timelib_strtotime(char *s, int len, struct timelib_error_container in.tzdb = tzdb; in.time->is_localtime = 0; in.time->zone_type = 0; + in.time->relative.days = TIMELIB_UNSET; do { t = scan(&in, tz_get_wrapper); diff --git a/ext/date/tests/bug60774.phpt b/ext/date/tests/bug60774.phpt new file mode 100644 index 0000000000..af8f4471d3 --- /dev/null +++ b/ext/date/tests/bug60774.phpt @@ -0,0 +1,30 @@ +--TEST-- +Bug #60774 (DateInterval::format("%a") is always zero when an interval is created using the createFromDateString method) +--FILE-- +format("%d"), "\n"; +echo $i->format("%a"), "\n"; +?> +--EXPECT-- +object(DateInterval)#1 (8) { + ["y"]=> + int(0) + ["m"]=> + int(0) + ["d"]=> + int(2) + ["h"]=> + int(0) + ["i"]=> + int(0) + ["s"]=> + int(0) + ["invert"]=> + int(0) + ["days"]=> + bool(false) +} +2 +(unknown)