Skip to content

after token_get_all() of a concatenated string, reading an int-keyed local array by key answers 0 #364

Closed

Description

@blacktrs

Summary

after token_get_all() of a concatenated string, reading an int-keyed local array by key answers 0.

Repro

<?php
/** @param int[] $keys */
function run(array $keys, string $name): void
{
    $ends = [];
    foreach ($keys as $k) {
        $ends[$k] = $k + 7;
    }
    foreach ($keys as $k) {
        $t = token_get_all('<?php use ' . $name . ';');
        echo $k, ' ', $ends[$k], "\n";
    }
}

run([2, 14, 31, 45, 64, 78, 93, 104], 'A');

Expected (php)

2 9
14 21
31 38
45 52
64 71
78 85
93 100
104 111

Actual (manticore 019b4fc3, Darwin arm64)

2 9
14 0
31 0
45 0
64 0
78 0
93 0
104 0

Tracking

Known-bug repro: tests/aot/repro/wrong/token_get_all_breaks_int_key_lookup.php — bash tests/aot/xfail.sh -k token_get_all_breaks_int_key_lookup reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions