From f31e0cd3345ab1d0b4a5f82a804b2a8868a307e1 Mon Sep 17 00:00:00 2001 From: Sean DuBois Date: Thu, 4 Feb 2016 15:13:57 -0600 Subject: [PATCH 1/4] Fix bug #71525 timelib_time->timelib_rel_time is mutated by date_modify, and because it is never zero'ed out it latters causes other date operations to fail (like date_date_set) --- ext/date/php_date.c | 1 + ext/date/tests/bug71525.phpt | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 ext/date/tests/bug71525.phpt diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 2c548ae6f47..2fe78a0e69f 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -3054,6 +3054,7 @@ static int php_date_modify(zval *object, char *modify, size_t modify_len) /* {{{ timelib_update_ts(dateobj->time, NULL); timelib_update_from_sse(dateobj->time); dateobj->time->have_relative = 0; + memset(&dateobj->time->relative, 0, sizeof(dateobj->time->relative)); return 1; } /* }}} */ diff --git a/ext/date/tests/bug71525.phpt b/ext/date/tests/bug71525.phpt new file mode 100644 index 00000000000..dadf926a5da --- /dev/null +++ b/ext/date/tests/bug71525.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #71525 (Calls to date_modify will mutate timelib_rel_time, causing date_date_set issues) +--FILE-- +modify('first day of next month'); +$date->setDate('2012', '1', '29'); +var_dump($date); + +--EXPECTF-- +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2012-01-29 00:00:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} From e027f16e947722ac69ed216ab60612b52dfaa45e Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 15 Feb 2016 08:21:46 +0100 Subject: [PATCH 2/4] update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 73019ff1e81..ac78099f988 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,10 @@ PHP NEWS . Bug #71559 (Built-in HTTP server, we can download file in web by bug). (Johannes, Anatol) +- Date: + . Fixed bug #71525 (Calls to date_modify will mutate timelib_rel_time, + causing date_date_set issues). (Sean DuBois) + - FPM: . Fixed #71269 (php-fpm dumped core). (Mickaƫl) From 199c0ec48df34e05f97726e82784bf65bc708035 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 15 Feb 2016 08:25:23 +0100 Subject: [PATCH 3/4] fix NEWS entry --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 07bdf235a46..51a95555058 100644 --- a/NEWS +++ b/NEWS @@ -7,7 +7,7 @@ PHP NEWS while curl_multi_exec). (Laruence) - CLI server: - . Bug #71559 (Built-in HTTP server, we can download file in web by bug). + . Fixed bug #71559 (Built-in HTTP server, we can download file in web by bug). (Johannes, Anatol) - Date: From 8f5cdca9c416369b039a555cb19583cd5f78a65e Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 15 Feb 2016 08:27:41 +0100 Subject: [PATCH 4/4] fixed news entry --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ac78099f988..ec278295d9b 100644 --- a/NEWS +++ b/NEWS @@ -19,7 +19,7 @@ PHP NEWS using count). (Nikita) - CLI server: - . Bug #71559 (Built-in HTTP server, we can download file in web by bug). + . Fixed bug #71559 (Built-in HTTP server, we can download file in web by bug). (Johannes, Anatol) - Date: