summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2016-02-15 15:32:52 +0800
committerXinchen Hui <laruence@gmail.com>2016-02-15 15:32:52 +0800
commitafe0ddf6dd21bcf9732181a0b27188e7adb6756f (patch)
tree60f21f6390a47ca674aaae93ad5d00aa305274a1
parente917402f053382e054baf16beabe264d83e417a4 (diff)
parent8f5cdca9c416369b039a555cb19583cd5f78a65e (diff)
downloadphp-git-afe0ddf6dd21bcf9732181a0b27188e7adb6756f.tar.gz
Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0
* 'PHP-7.0' of git.php.net:/php-src: fixed news entry fix NEWS entry update NEWS Fix bug #71525
-rw-r--r--NEWS6
-rw-r--r--ext/date/php_date.c1
-rw-r--r--ext/date/tests/bug71525.phpt18
3 files changed, 24 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 73019ff1e8..ec278295d9 100644
--- a/NEWS
+++ b/NEWS
@@ -19,9 +19,13 @@ 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:
+ . 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)
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 2c548ae6f4..2fe78a0e69 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 0000000000..dadf926a5d
--- /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--
+<?php
+$date = new DateTime('2011-12-25 00:00:00');
+$date->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"
+}