]> granicus.if.org Git - php/commitdiff
Fixed bug #68406 calling var_dump on a DateTimeZone object modifies it
authorCHU Zhaowei <jhdxr@php.net>
Sun, 11 Feb 2018 13:07:52 +0000 (21:07 +0800)
committerJoe <krakjoe@php.net>
Mon, 12 Feb 2018 08:20:14 +0000 (09:20 +0100)
NEWS
ext/date/php_date.c

diff --git a/NEWS b/NEWS
index 64906ed8df32760949ae7d474028c4d13c028e98..4339ecf9e41d29673820cfb7d0cb34dc92b54746 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,8 @@ PHP                                                                        NEWS
   . Implemented FR #74668: Add DateTime::createFromImmutable() method.
     (majkl578, Rican7)
   . Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr)
+  . Fixed bug #68406 (calling var_dump on a DateTimeZone object modifies it).
+    (jhdxr)
 
 - DBA:
   . Fixed bug #75264 (compiler warnings emitted). (petk)
index 9e52c071d68d803ed4833d4ffa1fc7fab1a596ce..df65c22b87a1f3779da6976307f0d7c12ed08bd4 100644 (file)
@@ -2417,9 +2417,9 @@ static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp
                        zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
 
                        ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
-                       tzobj->tzi.utc_offset > 0 ? '-' : '+',
-                       abs(tzobj->tzi.utc_offset / 60),
-                       abs((tzobj->tzi.utc_offset % 60)));
+                               tzobj->tzi.utc_offset < 0 ? '-' : '+',
+                               abs((int)(tzobj->tzi.utc_offset / 3600)),
+                               abs(((int)(tzobj->tzi.utc_offset % 3600) / 60)));
 
                        ZVAL_NEW_STR(&zv, tmpstr);
                        }