Skip to content

Commit 51f2a58

Browse files
jhdxrkrakjoe
authored andcommitted
Fixed bug #68406 calling var_dump on a DateTimeZone object modifies it
1 parent 766271a commit 51f2a58

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ PHP NEWS
4545
. Implemented FR #74668: Add DateTime::createFromImmutable() method.
4646
(majkl578, Rican7)
4747
. Fixed bug #75222 (DateInterval microseconds property always 0). (jhdxr)
48+
. Fixed bug #68406 (calling var_dump on a DateTimeZone object modifies it).
49+
(jhdxr)
4850

4951
- DBA:
5052
. Fixed bug #75264 (compiler warnings emitted). (petk)

ext/date/php_date.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,9 +2417,9 @@ static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp
24172417
zend_string *tmpstr = zend_string_alloc(sizeof("UTC+05:00")-1, 0);
24182418

24192419
ZSTR_LEN(tmpstr) = snprintf(ZSTR_VAL(tmpstr), sizeof("+05:00"), "%c%02d:%02d",
2420-
tzobj->tzi.utc_offset > 0 ? '-' : '+',
2421-
abs(tzobj->tzi.utc_offset / 60),
2422-
abs((tzobj->tzi.utc_offset % 60)));
2420+
tzobj->tzi.utc_offset < 0 ? '-' : '+',
2421+
abs((int)(tzobj->tzi.utc_offset / 3600)),
2422+
abs(((int)(tzobj->tzi.utc_offset % 3600) / 60)));
24232423

24242424
ZVAL_NEW_STR(&zv, tmpstr);
24252425
}

0 commit comments

Comments
 (0)