Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ PHP NEWS
. Fixed bug GH-19320 (FPM UID and GID overflow). (Pratik Bhujel)

- Intl:
. Fixed a memory leak when dumping IntlCalendar instances. (iliaal)
. Fixed a memory leak when iterating IntlBreakIterator::getPartsIterator()
results. (iliaal)
. Fixed a double-free when IntlGregorianCalendar construction fails after
Expand Down
2 changes: 2 additions & 0 deletions ext/intl/calendar/calendar_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ static HashTable *Calendar_get_debug_info(zend_object *object, int *is_temp)
FREE_HASHTABLE(debug_info_tz);

zend_hash_str_update(debug_info, "timeZone", sizeof("timeZone") - 1, &ztz_debug);

zval_ptr_dtor(&ztz);
}

{
Expand Down
26 changes: 26 additions & 0 deletions ext/intl/tests/calendar_get_debug_info_tz_leak.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
IntlCalendar get_debug_info() must not leak the time zone wrapper object
--EXTENSIONS--
intl
--FILE--
<?php
$cal = IntlCalendar::createInstance('UTC');
ob_start();
var_dump($cal);
ob_end_clean();

$o = new stdClass;
$before = spl_object_id($o);
unset($o);
for ($i = 0; $i < 10; $i++) {
ob_start();
var_dump($cal);
ob_end_clean();
}
$o = new stdClass;
$after = spl_object_id($o);

var_dump($after - $before);
?>
--EXPECT--
int(0)
Loading