Skip to content

Commit

Permalink
Fixed bug #68406 calling var_dump on a DateTimeZone object modifies it
Browse files Browse the repository at this point in the history
  • Loading branch information
jhdxr authored and sgolemon committed Feb 14, 2018
1 parent 7ae627c commit 47a3988
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
6 changes: 3 additions & 3 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 47a3988

Please sign in to comment.