ext/Intl: Fix memory leaks when calling Collator::__construct() or Spoofchecker::__construct() twice.#22386
Closed
LamentXU123 wants to merge 1 commit into
Closed
ext/Intl: Fix memory leaks when calling Collator::__construct() or Spoofchecker::__construct() twice.#22386LamentXU123 wants to merge 1 commit into
Collator::__construct() or Spoofchecker::__construct() twice.#22386LamentXU123 wants to merge 1 commit into
Conversation
…`Spoofchecker::__construct()` twice.
devnexen
approved these changes
Jun 22, 2026
LamentXU123
added a commit
that referenced
this pull request
Jun 22, 2026
* PHP-8.5: ext/intl: Fix double construction leaks (#22386)
pull Bot
pushed a commit
to Ammarpad/php-src
that referenced
this pull request
Jun 22, 2026
* PHP-8.4: ext/intl: Fix double construction leaks (php#22386)
LamentXU123
added a commit
that referenced
this pull request
Jun 22, 2026
* PHP-8.5: ext/intl: Fix Spoofchecker build after double construction change (#22386)
pull Bot
pushed a commit
to ppker/php-src
that referenced
this pull request
Jun 22, 2026
…p#22386) PHP-8.5 no longer declares a zend_error_handling variable in Spoofchecker::__construct(). The previous merge from PHP-8.4 carried forward a zend_replace_error_handling() call that references the removed local variable. Remove the stale call so PHP-8.5 and branches merged from it build again.
pull Bot
pushed a commit
to edisplay/php-src
that referenced
this pull request
Jun 22, 2026
IntlListFormatter stores a UListFormatter pointer. Calling the constructor again on an already initialized object overwrote the existing pointer and leaked the previous formatter. Follow up to the double construction fixes from phpGH-22386 by rejecting repeated IntlListFormatter::__construct() calls. Closes php#22394
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.
Both constructors could be called again on an already initialized object and would overwrite the existing ICU handles:
Collatoroverwrote theUCollator *Spoofcheckeroverwrote theUSpoofChecker */USpoofCheckResult *The previous handles were not released before being overwritten, so only the newly stored handles could be cleaned up during object destruction.
This aligns these classes with other ext/intl classes by rejecting double construction with an
Error. The similar bug happens on listformatter but I want to fix it in a separate PR because it need to target a different branch. (i.e. 8.5)