Skip to content

undefined optimizer behavior #21227

Closed
Closed

Description

@chongwick

Description

The following code:

<?php
function f_1() {
    $obj->a = 3;
    $blank_line = <<<EOT


    EOT;
    $array_default_key = array('one',       2,            'three', '4');
    $dom = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
    $test = function($a = 'a', $b = 'b', $c = 'c') {
        echo "a = $a, b = $b, c = $c\n";
    };
    $dom = new DOMDocument;
    $comment = $dom->createComment("foobarbaz");
    for ($i_2 = 0; $i_2 < 10; $i_2++) {
        $obj = $reflector->newLazyProxy(function ($obj) {
            var_dump("initializer");
            return new C();
        });
        $tStamp = mktime (17, 17, 17, 1, 4099, 1970);
        $x = "foo";
        $step = function () {
            throw new Exception();
        };
        $a = 30;
        $it = new RecursiveArrayIterator([[1]]);
        $objs = [];
        $obj = new stdClass;
        $objs[] = $obj;
        $table_name = "table_22pg_fetch_object";
        $sql = "SELECT * FROM $table_name WHERE num = 0";
        $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt', Pdo\Pgsql::class, true);
    }
    return $input % 2 === 0;
}

Resulted in this output:

/home/w023dtc/nightly_php/php-src/Zend/Optimizer/zend_inference.c:2117:13: runtime error: shift exponent 262 is too large for 32-bit type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/w023dtc/nightly_php/php-src/Zend/Optimizer/zend_inference.c:2117:13
USE_ZEND_ALLOC=0 php -d "opcache.memory_consumption=4096M" -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.jit=tracing" -d "opcache.validate_timestamps=0" -d "opcache.jit_buffer_size=128M" -d "opcache.file_update_protection=0" -d "opcache.max_accelerated_files=1000000" -d "opcache.interned_strings_buffer=64" -d "opcache.jit_prof_threshold=0.000000001" -d "opcache.jit_max_root_traces=  100000" -d "opcache.jit_max_side_traces=  100000" -d "opcache.jit_max_exit_counters=100000" -d "opcache.jit_hot_loop=1" -d "opcache.jit_hot_func=1" -d "opcache.jit_hot_return=1" -d "opcache.jit_hot_side_exit=1" -d "opcache.jit_blacklist_root_trace=255" -d "opcache.jit_blacklist_side_trace=255" -d "opcache.protect_memory=1" script.php

PHP Version

nightly

Operating System

No response

Activity

  1. self-assigned this
    on Feb 16, 2026
  2. added a commit that references this issue on Feb 17, 2026
    1931472
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions