E0043 reports stream resources that are read, written, or closed after they have already been closed. It is the stream-lifecycle member of Phanalist’s bounded formal verification family (E0031-E0043). The family shares a Z3-backed engine that encodes path conditions and values.
fread() or fwrite() on a stream that was closed on every feasible pathfread() or fwrite() on a stream that may have been closed on another pathfclose() on a stream that was already closed, or may already have been closed$alias = $stream, because both names refer to the
same tracked resourcefopen() resets its lifecycle stateE0043 tracks only resources assigned directly from fopen() and used directly
by fclose(), fread(), or fwrite(). It assumes fopen() succeeds unless a
later guard or contract narrows the value.
The following are not tracked and can cause missed findings:
fseek(), ftell(), fpassthru(), or
stream_*() functionsUnknown function, method, and static calls with a tracked stream argument invalidate that stream’s state, because the call may close it. This is conservative: it can miss a later use-after-close rather than report a false positive. Direct aliases share the same resource identity, but reassigning a reference alias to a different resource is not propagated back to the original name.
rules:
E0043:
php_version: "8.4"
See E0031 for the shared model limits, unknown_policy behavior,
and per-code configuration.