Skip to content

Assertion failure in normalize_value() when parsing malformed INI input via parse_ini_string() #20695

@vi3tL0u1s

Description

@vi3tL0u1s

Description

The following code:

<?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:

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions