[php-src] Issue #20695: Assertion failure in normalize_value() when parsing malformed INI input via parse_ini_string()
[email protected] (vi3tL0u1s)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <[email protected]> |
Issue: https://github.com/php/php-src/issues/20695
Author: vi3tL0u1s
### Description
The following code:
```php
<?php
class a {
function __destruct() {
try {
array_merge([' ' => [PHP_INT_MAX => null]], ['foo' == str_repeat('a', 2)],);
} catch (Throwable $e) {}
var_dump(parse_ini_string(<<<INI
8 [[$obj] = !!$]
INI, TRUE, INI_SCANNER_TYPED));
}
}
new a;
```
Resulted in this output:
```
php: /path/to/php-src/Zend/zend_ini_parser.y:317: normalize_value: Assertion `(*(zv)).u2.extra == 0 || (*(zv)).u2.extra == 1' failed.
Aborted
```
Commit:
```
2ee5e6b432c7ed51ff7296522c123551975be95b
```
Configurations:
```bash
CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic
```
### PHP Version
```plain
PHP 8.6.0-dev (cli) (built: Dec 13 2025 16:51:10) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
```
### Operating System
Ubuntu 22.04