[php-src] Issue #19261: ext/intl: Memory leaks when `MessageFormatter::parseMessage()` fails
| From: | Girgias | Date: | Sun, 27 Jul 2025 11:12:36 +0000 |
| Subject: | [php-src] Issue #19261: ext/intl: Memory leaks when `MessageFormatter::parseMessage()` fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250508@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19261
Author: Girgias
### Description
The following code:
```php
--TEST--
MessageFormatter::parseMessage() with invalid locale
--EXTENSIONS--
intl
--FILE--
<?php
$locale = 'root';
$fmt = '{0,whatever} would not work!';
$str = 'failing';
$m = MessageFormatter::parseMessage($locale, $fmt, $str);
var_dump($m);
var_dump(intl_get_error_message());
$m = msgfmt_parse_message($locale, $fmt, $str);
var_dump($m);
var_dump(intl_get_error_message());
?>
```
leaks memory if ran under ASAN.
Found while working on #19196
### PHP Version
```plain
master, but probably 8.3 and lower too
```
### Operating System
_No response_