[intl] Fix leak of time zone wrapper in Calendar debug info - #23503
Open
iliaal wants to merge 1 commit into
Open
[intl] Fix leak of time zone wrapper in Calendar debug info#23503iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
LamentXU123
approved these changes
Aug 29, 2026
Member
|
can we add the following test ? $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); -> should be 0 |
Calendar_get_debug_info() built a temporary IntlTimeZone wrapper zval via timezone_object_construct() and never released it, leaking one wrapper object per var_dump()/debug dump of an IntlCalendar. Release the wrapper with zval_ptr_dtor() after its debug info has been copied. Sibling audit: all other timezone_object_construct() call sites write into return_value and are refcount-managed; no other intl get_debug_info handler constructs temporary wrapper objects.
iliaal
force-pushed
the
fix/cal-getdebuginfo-tz-leak-84
branch
from
August 29, 2026 14:47
69dacd6 to
928b2ae
Compare
Member
Author
|
Done. |
devnexen
approved these changes
Aug 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calendar_get_debug_info() created a temporary IntlTimeZone wrapper zval via
timezone_object_construct() and never released it, leaking one wrapper object
per var_dump()/debug dump of an IntlCalendar instance. The wrapper is now
released with zval_ptr_dtor() after its debug info has been copied into the
result. Other timezone_object_construct() call sites write into return_value
and are refcount-managed. No other intl get_debug_info handler constructs a
temporary wrapper.