Skip to content

array_push spreading an erased array of arrays into an int list literal throws TypeError instead of appending them. #311

Closed

Description

@blacktrs

Summary

array_push spreading an erased array of arrays into an int list literal throws TypeError instead of appending them.

Repro

<?php
function build(): array { $l = []; $l[10][] = ['a', 1]; $l[5][] = ['b', 2]; return $l; }
$l = build();
$z = [0];
array_push($z, ...$l);
echo json_encode($z), "\n";

Expected (php)

[0,[["a",1]],[["b",2]]]

Actual (manticore 6df3b897, Darwin arm64)


[exit code 255]
PHP Fatal error:  Uncaught TypeError: Argument must be of type int, array given

Tracking

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