What’s New in OpenSwoole 26.2.0? PHP 8.5 Support, io_uring Reactor, Xdebug in Coroutines
OpenSwoole 26.2.0 introduces full PHP 8.5 compatibility, native Fiber coroutine context via zend_fiber, an io_uring‑based reactor and async file I/O engine, Xdebug step‑debugging inside coroutines, detailed event‑loop latency metrics, and numerous bug fixes and breaking changes, with upgrade instructions for PECL, Docker, and Composer.
Overview
OpenSwoole 26.2.0 is a major release that adds PHP 8.5 support, a native PHP Fiber coroutine context, an io_uring‑based reactor backend, Xdebug step‑debugging inside coroutines, event‑loop latency metrics, and many other enhancements.
New Features
PHP 8.5 Support
The extension is fully compatible with PHP 8.5, including new language features such as the pipe operator, URI extensions, and Clone With.
Native Fiber Coroutine Context
The coroutine context backend now uses the native zend_fiber API instead of Boost ASM or ucontext, allowing proper integration with Xdebug, profilers, and Fiber‑aware extensions. Runtime configuration: Co::set(['use_fiber_context' => true]); Or via INI:
openswoole.use_fiber_context=OnXdebug Step‑Debugging in Coroutines
When Fiber context is enabled, Xdebug step‑debugging works correctly inside coroutines, and the previous “extremely dangerous” warning has been removed.
Runtime Reactor Type Selection
You can choose the event‑reactor backend at runtime. Example:
Co::set(['reactor_type' => OPENSWOOLE_IO_URING]);New constants include OPENSWOOLE_EPOLL, OPENSWOOLE_KQUEUE, OPENSWOOLE_POLL, OPENSWOOLE_SELECT, and OPENSWOOLE_IO_URING.
io_uring Reactor Backend
The new reactor uses Linux io_uring with IORING_OP_POLL_ADD as a direct replacement for epoll. Enable it with --enable-io-uring (requires liburing). It supports multi‑shot polling on kernel 5.13+ and falls back automatically on older kernels.
io_uring Asynchronous File I/O Engine
A dedicated io_uring ring handles asynchronous file operations (open, read, write, fstat, fsync, unlink, rename, mkdir, rmdir) instead of a thread pool, with graceful fallback for unsupported operations.
Event‑Loop Latency Metrics
Use $server->stats() to monitor real‑time event‑loop latency. Each worker, task worker (when coroutines are enabled), and reactor thread (process mode) expose event_loop_lag_ms, event_loop_lag_max_ms, and event_loop_lag_avg_ms for detecting blocking operations.
Coroutine‑Safe exit() Support
On PHP 8.4+, calling exit() inside a coroutine throws an openswoole_exit_exception instead of terminating the whole process.
HTTP Parser Migration to llhttp
The custom openswoole_http_parser has been replaced by the llhttp parser, improving standards compliance and performance.
Bug Fixes
Fixed reflection issue and scope leak (#284): OSW_FUNCTION_ALIAS caused global functions to appear as class methods, breaking return types. Replaced with correct PHP_FE / PHP_FALIAS entries.
Fixed io_uring file I/O suspension race condition where eventfd notifications could be lost between draining and re‑arming single‑shot POLL_ADD.
Fixed file lock error: non‑blocking flock (LOCK_NB) now correctly checks coroutine lock state before the system flock() call.
Fixed CPU affinity compile check by adding missing _GNU_SOURCE definition before sched.h.
Fixed futex compile check by adding missing _GNU_SOURCE definition before linux/futex.h.
Breaking Changes
Dropped support for PHP 8.2 (minimum required version is now PHP 8.3).
Removed compatibility code for PHP < 8.0.
Namespace normalization: all symbols now use the openswoole_* prefix.
Upgrade
To install or upgrade OpenSwoole, refer to the installation documentation. Core library can be installed via Composer: composer require openswoole/core:26.2.0 Alternatively, install via PECL: pecl install openswoole-26.2.0 Or pull the Docker image:
docker pull openswoole/openswoole:26.2-php8.5-alpineSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
