[php-src] Issue #21210: parse_ini_string() fails on "(" character in comment
| From: | tstoeckler | Date: | Thu, 12 Feb 2026 20:26:52 +0000 |
| Subject: | [php-src] Issue #21210: parse_ini_string() fails on "(" character in comment | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251687@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/21210
Author: tstoeckler
### Description
The following code:
```php
<?php
print_r(parse_ini_string("# a comment (with parens)\nkey=value\n"));
```
Resulted in this output:
```
PHP Warning: syntax error, unexpected '(' in Unknown on line 1
in Command line code on line 1
```
But I expected this output instead:
```
Array
(
[key] => value
)
```
in particular because it is the output of
```php
<?php
print_r(parse_ini_string("# a comment\nkey=value\n"));
```
### PHP Version
```plain
PHP 8.5.0 (cli) (built: Nov 18 2025 08:02:20) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine
Zend Engine v4.5.0, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
with Zend OPcache v8.5.0, Copyright (c), by Zend Technologies
(Also tested with PHP 8.4 with the same result)
```
### Operating System
Fedora Linux 43