Skip to content

sprintf() over a spread array literal holding a mixed (cell) value leaks the literal array. #357

Closed

Description

@blacktrs

Summary

sprintf() over a spread array literal holding a mixed (cell) value leaks the literal array.

Repro

<?php
function t(array $p): int { $c = $p[0]; return strlen(sprintf("%s!", ...[$c])); }
$p = ["ab", 1];
t($p);
$b = memory_get_usage();
for ($i = 0; $i < 50000; $i++) { t($p); }
echo (memory_get_usage() - $b) < 500000 ? "flat" : "leak", "\n";

Expected (php)

flat

Actual (manticore e9a8ff7f, Darwin arm64)

leak

Tracking

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

    bugleak

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions