Highlights
Worker-mode entry now prefers the OxPHP\Server\Worker class introduced in the OxPHP extension (v0.9.0), with a transparent fallback to the free oxphp_*() functions on older servers. Runtime behaviour is unchanged.
| Legacy | Class API |
|---|---|
oxphp_is_worker() |
Worker::isWorkerMode() |
oxphp_worker($h) |
Worker::current()->serve($h) |
The other oxphp_* calls have no class analog and are left untouched. Scope is intentionally minimal (YAGNI) — scheduleExit/requestCount/rss/memoryUsage are not adopted.
Changes
- Worker class migration —
Internal\Bridge\OxPHPis now the single point that decides class vs free function: constructor seam?bool $useWorkerClass(autodetect viaclass_exists), newserve(callable): void, dual-pathisWorker(). The directoxphp_worker()call is moved out of the runner, restoring the "only the bridge callsoxphp_*" invariant.AbstractHttpRunnerdrives the loop through$this->bridge->serve(); the "a broken handler must never poison the worker" invariant is preserved. - Fix: runner dispatch testable under CLI SAPI —
Runtime::getRunner()coupled the SAPI gate with the type→runner dispatch table, so thePHP_SAPI === 'cli'gate short-circuited it under PHPUnit. The dispatch is extracted into a privateresolveRunner();getRunner()behaviour and the publicRuntimeAPI are unchanged.
Compatibility
No breaking changes. The only public classes (Runtime, ResetterInterface) are unchanged. Works on both new (class-based) and older (function-based) OxPHP servers.
Full Changelog: v0.1.1...v0.2.0