Skip to content

An untyped property documented @var resource|null that is assigned false crashes the next $this->os ?? $this->ld read #240

Closed

Description

@blacktrs

Summary

An untyped property documented @var resource|null that is assigned false crashes the next $this->os ?? $this->ld read.

Repro

<?php
class A
{
    /** @var callable|null */
    protected $ld;
    /** @var resource|null */
    protected $os;

    public function set($o)
    {
        $prev = $this->os ?? $this->ld;
        if (\is_callable($o)) {
            $this->os = null;
            $this->ld = $o;
        } else {
            $this->os = $o;
            $this->ld = $this->m(...);
        }
        return $prev;
    }

    protected function m(string $l): void {}
}
$a = new A();
var_dump($a->set(false));
var_dump($a->set(fopen('php://memory', 'r+')));
var_dump(is_resource($a->set(false)));

Expected (php)

NULL
bool(false)
bool(true)

Actual (manticore b31cd215, Darwin arm64)


[exit code 139 — SIGSEGV]

Tracking

Known-bug repro: tests/aot/repro/crash/docblock_resource_prop_holding_false.php — bash tests/aot/xfail.sh -k docblock_resource_prop_holding_false 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 13, 2026
  2. added 2 commits that reference this issue on Oct 14, 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

    bugcrash

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions