Skip to content

An int appended from a shape element of a function result (array{0: int, 1: string}) makes the int list compare unequal to its own values. #369

Closed

Description

@blacktrs

Summary

An int appended from a shape element of a function result (array{0: int, 1: string}) makes the int list compare unequal to its own values.

Repro

<?php
/** @return array<int, array{0: int, 1: string}> */
function pairs(): array
{
    $out = [];
    $out[] = [319, 'A'];
    return $out;
}

/** @param int[] $kind */
function find(array $kind): int
{
    foreach ($kind as $j => $k) {
        if ($k === 40) {
            return $j;
        }
    }
    return -1;
}

$kind = [355];
foreach (pairs() as $p) {
    $kind[] = $p[0];
}
$kind[] = 40;
echo find($kind), "\n";

Expected (php)

2

Actual (manticore 35f83817, Darwin arm64)

-1

Tracking

Known-bug repro: tests/aot/repro/wrong/shape_elem_into_int_list.php — bash tests/aot/xfail.sh -k shape_elem_into_int_list 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