[php-src] PR #22386: ext/Intl: Fix memory leaks when calling `Collator::__construct()` or `Spoofchecker::__construct()` twice.
| From: | LamentXU123 | Date: | Sun, 21 Jun 2026 16:53:10 +0000 |
| Subject: | [php-src] PR #22386: ext/Intl: Fix memory leaks when calling `Collator::__construct()` or `Spoofchecker::__construct()` twice. | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36534@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22386
Author: LamentXU123
Both constructors could be called again on an already initialized object and would overwrite the
existing ICU handles:
-
Collator overwrote the UCollator *
- Spoofchecker overwrote the USpoofChecker * / 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.