Skip to content

With a __call class in the program, bindTo(null) on a static closure read back from a static array yields a closure that returns 0 #293

Closed

Description

@blacktrs

Summary

With a __call class in the program, bindTo(null) on a static closure read back from a static array yields a closure that returns 0.

Repro

<?php
class Magic { public function __call($n, $a) { return "magic:$n"; } }
final class Reg {
    private static array $h = [];
    public static function get(string $k): mixed { return self::$h[$k] ??= static function (int $x) { return $x * 2; }; }
}
$b = Reg::get('a')->bindTo(null);
echo $b(6), "\n";

Expected (php)

12

Actual (manticore 0ffa52e9, Darwin arm64)

0

Tracking

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