Fix IntlGregorianCalendar double-free of an adopted TimeZone - #23321
Open
iliaal wants to merge 1 commit into
Open
Fix IntlGregorianCalendar double-free of an adopted TimeZone#23321iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
GregorianCalendar(TimeZone*, ...) adopts the zone in the constructor. On U_FAILURE the calendar destructor already deletes that zone. Remove the extra delete tz. The 8.5/master unique_ptr path has the same extra delete after the smart pointer already destroyed the calendar.
iliaal
force-pushed
the
fix/intl-gcal-adopt-df
branch
from
August 16, 2026 16:36
5ca1d40 to
b5943e9
Compare
Contributor
Author
|
Yeah, updated to 8.4 |
LamentXU123
requested changes
Aug 16, 2026
| echo $cal->getType(), "\n"; | ||
|
|
||
| $cal2 = IntlGregorianCalendar::createInstance('UTC', 'en_US'); | ||
| echo $cal2->getTimeZone()->getID(), "\n"; |
Member
There was a problem hiding this comment.
IMO The added test does not exercise the fix.
You see, both constructions succeed, while the removed deletion runs only under U_FAILURE(status). The test produces identical expected output on an affected PHP 8.6.0beta1 build.
See here
Member
|
Otherwise this looks good. |
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.
The timezone-and-locale IntlGregorianCalendar constructor passes the TimeZone to an adopting ICU constructor. On failure PHP deleted that zone again after delete gcal already ran the calendar destructor.