Skip to content

A callable that returns an object read from an array element, stored into an array, traps (refcount underflow). #173

Closed

Description

@blacktrs

Summary

A callable that returns an object read from an array element, stored into an array, traps (refcount underflow).

Repro

<?php
final class E {
    public function __construct(private string $value) {}
    public function toString(): string { return $this->value; }
}
function run(array $elements, callable $get): void {
    $items = [];
    foreach ($elements as $i => $e) { $items[] = [$e, $i, $get($e)]; }
    echo count($items), "\n";
}
$inner = [['expression' => new E('string')], ['expression' => new E('int')]];
run($inner, static fn (array $v): E => $v['expression']);
echo $inner[0]['expression']->toString(), $inner[1]['expression']->toString(), "\n";

Expected (php)

2
stringint

Actual (manticore ed5d7d39, Darwin arm64)


[exit code 133]

Tracking

Known-bug repro: tests/aot/repro/crash/callable_returning_array_elem_object_stored_in_array.php — bash tests/aot/xfail.sh -k callable_returning_array_elem_object_stored_in_array 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
    crash
    on Oct 11, 2026
  2. added a commit that references this issue on Oct 11, 2026
    2bcef85
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

    bugcrash

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions