Skip to content

get_class() of $obj ?? new Other folds to the static class of the left operand #226

Closed

Description

@blacktrs

Summary

get_class() of $obj ?? new Other folds to the static class of the left operand.

Repro

<?php
class A { public ?A $c = null; function get(): ?A { return $this->c; } }
$a = new A;
$c = $a->get();
echo get_class($c ?? new stdClass), "\n";

Expected (php)

stdClass

Actual (manticore f9ab5637, Darwin arm64)

A

Tracking

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