OpaqueExchange
in package
One in-flight OPAQUE exchange, owning a native state handle.
The handle is single-use: the library consumes it in finish whether that succeeds or
fails. This class takes it out of a one-shot slot, so a second finish raises a PHP exception
rather than handing a dangling pointer across the ABI.
__destruct releases an exchange the caller abandoned — a login started and never completed.
PHP's refcounting makes that prompt rather than eventual, which is the one place its object
model is kinder here than a tracing GC's.
Table of Contents
Methods
- __construct() : mixed
- Adopts `$handle`, which this exchange now owns and must release exactly once — through `finish`, `close()` or the destructor, whichever comes first.
- __destruct() : mixed
- Releases an exchange the caller abandoned — a login started and never completed. PHP's refcounting makes that prompt rather than eventual.
- close() : void
- Releases the exchange if it was never finished.
Methods
__construct()
Adopts `$handle`, which this exchange now owns and must release exactly once — through `finish`, `close()` or the destructor, whichever comes first.
public
__construct(OpaqueNativeInterface $lib, mixed $handle, string $firstMessage) : mixed
Parameters
- $lib : OpaqueNativeInterface
- $handle : mixed
- $firstMessage : string
__destruct()
Releases an exchange the caller abandoned — a login started and never completed. PHP's refcounting makes that prompt rather than eventual.
public
__destruct() : mixed
close()
Releases the exchange if it was never finished.
public
close() : void
Idempotent, and a no-op once finish has spent the handle. Calling it is optional —
__destruct does the same thing — but an application that knows the exchange is over
should not wait for a refcount to say so.