Skip to content

substr($s, $o, null) with a null length returns "" instead of the rest of the string. #321

Closed

Description

@blacktrs

Summary

substr($s, $o, null) with a null length returns "" instead of the rest of the string.

Repro

<?php
function f(mixed $len) { var_dump(substr('hello', 1, $len)); }
f(null);

Expected (php)

string(4) "ello"

Actual (manticore 4f6a0a83, Darwin arm64)

string(0) ""

Tracking

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