Skip to content

array_splice of strings into an array $a param that call sites pass ints throws TypeError #307

Closed

Description

@blacktrs

Summary

array_splice of strings into an array $a param that call sites pass ints throws TypeError.

Repro

<?php
function t(array $a, int $off, ?int $len = null, mixed $repl = []): void {
    $r = array_splice($a, $off, $len, $repl);
    echo json_encode([$a, $r]), "\n";
}
t([10, 20, 30], 1, 1, ["x"]);

Expected (php)

[[10,"x",30],[20]]

Actual (manticore 6df3b897, Darwin arm64)


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

Tracking

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