Skip to content

$x instanceof self::$prop (class name held in a static property) fails to parse. #619

Closed

Description

@blacktrs

Summary

$x instanceof self::$prop (class name held in a static property) fails to parse.

Repro

<?php
// reported in #614 (phpseclib Math/BigInteger.php)
class Engine {}
class BigInteger {
    private static $mainEngine = Engine::class;
    public static function check($x): bool { return $x instanceof self::$mainEngine; }
}
var_dump(BigInteger::check(new Engine), BigInteger::check(new stdClass));

Expected (php)

bool(true)
bool(false)

Actual (manticore c421455f, Darwin arm64)

compile failed (rc=65):
tests/aot/repro/wrong/instanceof_static_property_class.php:7:71: error: expected ';' after return
Found 1 error(s), 0 warning(s).
compile failed: lazy body tests/aot/repro/wrong/instanceof_static_property_class.php:7 [{ return $x instanceof self::$mainEngine; }]: expected ';' after return at line 7, column 67
compile: front-end (parse/typeck/IR) returned null (rc=65)

Tracking

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