summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCHU Zhaowei <jhdxr@php.net>2018-02-11 21:07:52 +0800
committerSara Golemon <pollita@php.net>2018-02-14 11:27:41 -0500
commit47a39882366604bb6f184987be9e56d3ee2810b9 (patch)
tree8a9f6627c10ea3955b6d035c8983d45c1c9b61e7
parent7ae627cceaa40bad2749a648fd9a42795f1b0fd0 (diff)
downloadphp-git-47a39882366604bb6f184987be9e56d3ee2810b9.tar.gz
Fixed bug #68406 calling var_dump on a DateTimeZone object modifies it
-rw-r--r--NEWS2
-rw-r--r--ext/date/php_date.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index f070163a72..552e2a5a03 100644
--- a/NEWS
+++ b/NEWS
@@ -273,6 +273,8 @@ PHP NEWS
DateTimeInterface interface). (Majkl578)
. Fixed bug #75149 (redefinition of typedefs ttinfo and t1info). (Remi)
. 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 #72885 (flatfile: dba_fetch() fails to read replaced entry).
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 82ac9a6502..2df19f718a 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2422,9 +2422,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);
}