Releases: swoole/swoole-src
v6.1.0-rc1
Standard Library Extension
In version 6.1
, Swoole-Cli
will introduce extended syntax for the PHP
standard library, providing additional new syntax while maintaining full compatibility with the official PHP
syntax. These new extended syntax features are entirely optional and do not affect existing PHP
code. The standard library extension syntax will be implemented in the stdext
module of ext-swoole
.
swoole-cli
users can use it directly without any additional parameters.ext-swoole
users need to add--enable-swoole-stdext
during compilation to enable it.stdext
can be used inphp-cli
,php-fpm
,cli-http-server
, andswoole
modes.
1. Object-Oriented Basic Types
Version 6.1
implements object-oriented encapsulation of basic types such as array
, string
, and stream
, supporting method calls in an object-oriented style. Built-in methods can be directly called on variables of these types.
The built-in methods for basic types still utilize the PHP
standard library. These methods correspond one-to-one with PHP
's str_
or array_
series functions. For example, $text->replace()
corresponds to the str_replace
function. The underlying implementation only adjusts function names, slightly modifies the parameter order for a few methods, and adjusts parameter and return value types for several others. For details, please refer to the Swoole Documentation.
$text = 'Hello Swoole';
var_dump($text->length());
echo $text->lower()->replace("swoole", "php");
echo fopen("/tmp/test.log")->read(1024);
2. Typed-Array
Typed arrays can enforce type constraints, such as Map
or ArrayList
, and restrict the types of keys and values. Multi-level nested formats are supported. Typed arrays are still essentially array
types, with parameter checks performed only during write operations. Typed arrays can be passed as array
to other functions or class methods.
$array = typed_array('<int, string>');
$array[1000] = "hello"; // Correct
$array[2000] = 2025; // Error, throws an exception
✨ New Features
- Default llHTTP Parser: Starting from v6.1.0, Swoole uses the higher-performance
llhttp
as the default HTTP message parser, replacinghttp_parser
. - Coroutine-Based File Download:
Swoole\Coroutine\Http\Client
now supports full coroutine-based file download operations. - Asynchronous File Truncation: Added support for
iouring ftruncate
, expanding asynchronous file operation capabilities.
🐛 Bug Fixes
- Thread Mode Optimization:
- Fixed the issue where
hook_flags
settings were ineffective inSWOOLE_THREAD
mode. - Fixed the issue where heartbeat threads held invalid pointers and accessed freed memory after worker threads restarted due to reaching the
max_request
limit. - Fixed the issue where
Task
processes could not be restarted individually.
- Fixed the issue where
- Stability Improvements:
- Fixed the issue where synchronous processes (including manager and task processes) could not use
process::signal()
properly. - Corrected the resource cleanup mechanism when worker processes exit abnormally.
- Resolved compilation failures on the Cygwin platform.
- Fixed the issue where curl could not reuse sockets when keepalive was enabled.
- Improved the logging component to address data consistency issues in multi-threaded mode.
- Fixed compilation failures of the
futex
feature inio_uring
onubuntu24.04
. - Fixed compilation failures caused by struct sequential assignment on older Linux systems.
- Fixed the issue where the
id
property of directly instantiatedSwoole\Process
objects was uninitialized. - Fixed the missing
--enable-zstd
option in composer.json when compiling Swoole withPIE
.
- Fixed the issue where synchronous processes (including manager and task processes) could not use
- Compatibility Improvements:
- Fixed compatibility issues with
php_swoole_register_shutdown_function
on PHP 8.5. - Corrected the handling of null parameters in
Swoole\Table::get()
.
- Fixed compatibility issues with
- Protocol Handling:
- Optimized the handling of duplicate fields in HTTP request and response headers to ensure proper merging.
- Fixed the issue where a warning about an unknown compression method was triggered when processing client
Accept-Encoding: zlib
headers withoutzlib
installed.
Deprecations
- Support for the
select
event mechanism has been removed.select
only supports event monitoring for up to1024
handles and has significant limitations. On platforms that do not supportepoll/kqueue
,poll
will be used as the event polling mechanism, enabling support for high concurrency even on theCygwin
platform. - The second parameter
$waitEvent
inSwoole\Server::stop()
has been deprecated. Please use thereload_async
parameter instead.
🛠️ Architectural Optimizations
Version 6.1
adds extensive unit tests for core modules, increasing test coverage to 86%. By systematically supplementing test cases and refactoring underlying code logic, combined with full static code analysis using the clang-tidy
toolchain, automated code formatting and redundancy cleanup have been achieved, significantly improving code readability and maintainability.
- Optimized the underlying
SSL
module. - Optimized the underlying
Socket
module. - Refactored the underlying synchronous signal module.
- Refactored the underlying
reactor
andstring
modules. - Refactored the underlying dynamic log file reloading mechanism based on
SIGRTMIN
signals. - Optimized the underlying static file server by removing C-style code and unifying it into C++-style code.
- Optimized thread initialization logic to improve multi-threaded performance. Memory for independent management structures is now managed separately, eliminating the need for locks during thread creation and exit.
- Removed the
socket_dontwait
option from the underlyingasync
module, as it is deprecated. - Improved test coverage for
WebSocket
mask handling. - Optimized the
sendfile
functionality to avoid setting thetcp_cork
option for files smaller than64KB
. - Added unit tests for
aarch64
andmacOS
environments. - Optimized underlying client network address resolution and settings.
- Added
ssl_cafile/ssl_capath
configuration items for theServer
module. - Added the
print_backtrace_on_error
configuration, which prints C function stack traces when location errors occur. - Added the
Address Sanitizer
debugging tool. - Added
Cygwin
testing, significantly improving compatibility and stability on theCygwin
platform. - On
macOS
systems, thekqueue
event mechanism does not support cross-process pipe event monitoring, making it impossible to useSWOOLE_PROCESS
mode andTask
processes. Therefore, the system defaults to usingpoll
as the underlying event mechanism. To enablekqueue
, manually activate it usingSwoole\Server::set(['enable_kqueue' => true])
andswoole_async_set(['enable_kqueue' => true])
.
⚠️ Note
- This version is an
RC
(Release Candidate) and not an official release. It is recommended for use only in testing environments and should not be used in production.
🙏 Thank You
Sincere thanks to @matyhtf @jingjingxyk @sy-records @KIMDONGYEON00 @ServBayDev @NathanFreeman and all contributors for their professional efforts. Swoole is stronger because of you! Wishing all open-source community partners good health, success in all endeavors, and smooth work.
标准库扩展
6.1
版本 Swoole-Cli
将增加 PHP
标准库扩展语法,在保持对 PHP
官方语法完整兼容的同时,提供一些额外的新语法。这些新的扩展语法均是可选的,不影响现有的PHP
代码。标准库扩展语法将在ext-swoole
的stdext
模块中实现。
swoole-cli
用户,可直接使用,无需设置任何额外的参数ext-swoole
的用户,需在编译时添加--enable-swoole-stdext
来启用stdext
在php-cli
、php-fpm
、cli-http-server
、swoole
模式均可使用
1. 基础类型对象化
6.1
版本实现了array
/string
/stream
基础类型的对象化封装,支持面向对象风格的方法调用,可直接对这些类型的变量调用内置方法。
基础类型的内置方法实际上仍然是调用PHP
标准库实现的,内置方法与PHP
的str_
或array_
系列函数是一一对应关系,例如$text->replace()
对应的函数是str_replace
。底层仅调整了函数名称,少量方法调整了参数顺序,还有几个方法调整了参数和返回值类型,详情请查看 Swoole 文档。
$text = 'Hello Swoole';
var_dump($text->length());
echo $text->lower()->replace("swoole", "php");
echo fopen("/tmp/test.log")->read(1024);
2. Typed-Array 强类型数组
可限制数组类型,如:Map
或ArrayList
,以及限制key
与value
的类型。支持多层嵌套格式。typed array
实际上依然是array
类型,底层仅在写入时进行参数检查。typed array
可作为array
传递给其他函数或类方法。
$array = typed_array('<int, string>');
$array[1000] = "hello"; // 正确
$array[2000] = 2025; // 错误,抛出异常
✨ 新特性
- llHTTP 默认解析器:自 v6.1.0 起,Swoole 采用性能更优的
llhttp
替代http_parser
作为默认 HTTP 报文解析器。 - 协程化文件下载:
Swoole\Coroutine\Http\Client
现支持完整的协程化文件下载操作。 - 异步文件截断:新增
iouring ftruncate
支持,扩展异步文件操作能力。
🐛 Bug 修复
- 线程模式优化:
- 修复
SWOOLE_THREAD
模式下hook_flags
设置失效问题。 - 修复因工作线程达到
max_request
限制重启后,导致心跳线程持有失效指针并访问已释放内存的问题。 - 修复不支持单独重启
Task
进程的问题。
- 修复
- 稳定性提升:
- 修复同步进程(含 manager 进程和 task 进程)无法正常使用
process::signal()
的问题。 - 修正工作进程异常退出时的资源清理机制。
- 解决 Cygwin 平台编译失败问题。
- 修复curl开启keepalive无法复用socket的问题。
- 改进日志组件以解决多线程模式下的数据一致性问题。
- 修复
io_uring
的futex
特性在ubuntu24.04
编译失败的问题。 - 修复结构体顺序赋值在低版本的linux系统会编译失败的问题。
- 修复直接实例化的
Swoole\Process
对象其id
属性未初始化的问题。
- 修复同步进程(含 manager 进程和 task 进程)无法正常使用
- 修复使用
PIE
编译swoole时,composer.json文件缺少--enable-zstd
的选项的问题。 - 兼容性改进:
- 修复 PHP 8.5 下
php_swoole_register_shutdown_function
兼容性问题。 - 修正
Swoole\Table::get()
对 null 参数的处理。
- 修复 PHP 8.5 下
- 协议处理:
- 优化
HTTP
请求头与响应头中重复字段的处理机制,确保其正确合并。 - 修复当系统没有
zlib
时,处理客户端Accept-Encoding: zlib
请求头会触发未知压缩方法警告的问题。
- 优化
废弃
- 不再支持
select
事件机制,select
仅支持1024
个句柄的事件监听,存在严重缺陷,在不支持epoll/kqueue
的平台将使用poll
作为事件轮训机制,这使得Cygwin
平台下也可以支持大量并发。 - 在
Swoole\Server::stop()
方法中,第二个参数$waitEvent
已被废弃,请使用reload_async
参数。
🛠️ 架构优化
6.1
版本增加了大量核心模块的单元测试,测试覆盖率提升至**8...
v5.1.8
🐛 Bug Fixes
- Fixed compatibility issues when thread context is enabled with older GCC versions compiling Swoole.
- Fixed CPU affinity support detection failure in newer GCC versions due to missing _GNU_SOURCE macro definition.
- Fixed the issue where synchronous processes (including manager and task processes) couldn't properly use process::signal().
- Fixed missing serverLastStreamId property in HTTP2 coroutine client.
- Fixed the "unknown compression method" warning when system lacks zlib support but client requests zlib in Accept-Encoding header.
- Fixed missing id property in Swoole\Process class.
😊 Thank You
Heartfelt thanks to all contributors @NathanFreeman @xuanyanwow @deminy for your professional dedication. Swoole grows stronger because of you! Wishing our open-source community members good health, success in all endeavors, and smooth work.
🐛 Bug 修复
- 修复 thread context 开启时与低版本 GCC 编译 Swoole 的兼容性问题。
- 修复高版本 GCC 编译时因缺少 _GNU_SOURCE 宏定义导致的 CPU 亲和支持检测失效问题。
- 修复同步进程(含 manager 进程和 task 进程)无法正常使用 process::signal() 的问题。
- 修复 HTTP2 协程客户端缺少 serverLastStreamId 属性的问题。
- 修复系统无 zlib 支持时,客户端请求 Accept-Encoding 含 zlib 会触发未知压缩方法警告的问题。
- 修复 Swoole\Process 类缺少 id 属性的问题。
😊 致谢
诚挚感谢 @NathanFreeman @xuanyanwow @deminy 所有贡献者的专业付出,Swoole 因你们而更强大!愿开源社区伙伴身体健康,万事如意,工作顺利。
v6.0.2
✨ New Features:
- Added
Swoole\Thread::yield()
,Swoole\Thread::activeCount()
, andSwoole\Thread::isAlive()
methods. @matyhtf
🐛 Bug Fixes:
- Fixed an issue where using single-thread mode and setting heartbeat in
SWOOLE_THREAD
mode would cause exceptions. @matyhtf - Fixed a segmentation fault issue after enabling
swoole.enable_fiber_mock
. @NathanFreeman - Fixed an integer overflow issue in the Redis server. @yannaingtun
📢 Note:
- The Redis server currently only supports the
RESP2
protocol. When formatting strings that do not comply with this protocol, an exception will be thrown instead of logging. @matyhtf
😊 Thank you:
- Thank you for your contributions to Swoole v6.0.2. Wishing everyone good health, success, and smooth work.
✨ 新特性:
- 增加
Swoole\Thread::yield()
,Swoole\Thread::activeCount()
和Swoole\Thread::isAlive()
方法。 @matyhtf
🐛 Bug修复:
- 修复在
SWOOLE_THREAD
模式下,使用单线程模式和设置心跳会引发异常的问题。 @matyhtf - 修复开启
swoole.enable_fiber_mock
后的段错误问题。 @NathanFreeman - 修复Redis服务端的整型溢出问题。 @yannaingtun
📢 注意:
- Redis服务端目前将仅支持
RESP2
协议,当格式化不符合该协议的字符串时,将抛出异常而不是记录日志。 @matyhtf
😊 致谢:
- 感谢你们为Swoole v6.0.2做出的贡献,祝愿大家身体健康,万事如意,工作顺利。
v5.1.7
🐛 Bug Fixes:
- Fixed an issue where PostgreSQL would revert to synchronous mode under coroutine when receiving large amounts of data. @NathanFreeman
- Fixed an issue where dynamically creating properties in
Swoole\Http2\Request
would throw an exception. @xuanyanwow @guandeng - Fixed a memory error caused by fatal errors occurring in one-click coroutine. @matyhtf
😊 Thank you:
- Thank you for your contributions to Swoole v5.1.7. Wishing everyone good health, success in all endeavors, and smooth sailing in your work.
🐛 Bug修复:
- 修复Postgresql在协程化下在接收大量数据会退化成同步模式下的问题。 @NathanFreeman
- 修复
Swoole\Http2\Request
动态创建类的属性抛出异常的问题。 @xuanyanwow @guandeng - 修复一键协程化中发生的致命错误会导致内存错误的问题。 @matyhtf
😊 致谢:
- 感谢你们为Swoole v5.1.7做出的贡献,祝愿大家身体健康,万事如意,工作顺利。
v6.0.1
🐛 Bug Fixes:
- Fixed an issue in
SWOOLE_THREAD
mode where the process could not exit properly due to not removing the listening event. @NathanFreeman - Fixed an issue where large file uploads failed when the
single_thread
configuration was enabled. @matyhtf - Fixed an issue where compilation could not find the specific file path if the same variable was already defined in
config.m4
. @matyhtf - Fixed an issue in
Swoole\Process\Pool
where processes could not exit properly upon timeout. @matyhtf - Fixed an issue in
SWOOLE_THREAD
mode where callingputenv
caused the program to crash. @matyhtf - Fixed an issue in
SWOOLE_THREAD
mode where event callback functions could not be set for independent ports. @matyhtf - Fixed an issue in
SWOOLE_THREAD
mode where runtime parameters could not be retrieved in events such asonWorkerStart
. @matyhtf - Fixed an issue where Postgresql would degrade to synchronous mode when receiving large amounts of data under coroutine. @NathanFreeman
- Optimized the parameter judgment logic of
swoole_substr_json_decode
/swoole_substr_unserialize
functions. @Appla - Fixed an issue with CPU affinity settings in
config.m4
. @remicollet - Fixed an issue in
SWOOLE_THREAD
mode where the heartbeat detection did not function properly. @matyhtf
📢 Note:
- In the Http service, if the process restarts, the underlying layer will send a 500 Internal Server to requests waiting in the queue, close the connection, and discard these requests after sending. @NathanFreeman
- Since the runtime configuration relied upon by the
stream factory
andstream ops
in the PHP underlying is not thread-safe, in multi-thread mode, only the main thread is allowed to modify these runtime configurations before creating child threads. @matyhtf - Upgrade nghttp2 to the latest version. @NathanFreeman
😊 Thank you:
- Thank you for your contribution to
Swoole v6.0.1
. Wish you good health, all the best, and smooth work.
🐛 Bug修复:
- 修复
SWOOLE_THREAD
模式下,因为没有移除监听事件导致进程无法正常退出的问题。 @NathanFreeman - 修复当开启
single_thread
配置时,无法上传大文件的问题。 @matyhtf - 修复如果已经定义了
config.m4
中相同的变量,会导致编译过程找不到具体的文件路径的问题。 @matyhtf - 修复
Swoole\Process\Pool
中进程超时无法正常退出的问题。 @matyhtf - 修复
SWOOLE_THREAD
模式下,调用putenv
导致程序崩溃的问题。 @matyhtf - 修复
SWOOLE_THREAD
模式下,无法为独立的端口设置事件回调函数的问题。 @matyhtf - 修复
SWOOLE_THREAD
模式下,onWorkerStart
等事件中无法获取到运行时的各项参数的问题。 @matyhtf - 修复Postgresql在协程化下在接收大量数据会退化成同步模式下的问题。 @NathanFreeman
- 优化
swoole_substr_json_decode
/swoole_substr_unserialize
函数的参数判断逻辑。 @Appla - 修复
config.m4
中的CPU亲和性设置的问题。 @remicollet - 修复
SWOOLE_THREAD
模式下,心跳检测不起作用的问题。 @matyhtf
📢 注意:
- 在Http服务中,如果进程重启时,底层会发送500 Internal Server给队列中等待处理的请求,发送完毕就关闭连接并丢弃这些请求。 @NathanFreeman
- 由于php底层的
stream factory
和stream ops
依赖的运行时配置不是线程安全的,因此多线程模式下只允许主线程在还没创建子线程之前修改这些运行时配置。 @matyhtf - 升级nghttp2到最新版本。 @NathanFreeman
😊 致谢:
- 感谢你们为
Swoole v6.0.1
做出的贡献,祝愿大家身体健康,万事如意,工作顺利。
v6.0.0
✨ New Feature:
- Added multi-threading support, require the ZTS version of PHP. Add
--enable-swoole-thread
option to the configure command to activate it. - Added a new thread class
Swoole\Thread
. @matyhtf - Introduced thread lock
Swoole\Thread\Lock
. @matyhtf - Added thread atomic counter
Swoole\Thread\Atomic
,Swoole\Thread\Atomic\Long
. @matyhtf - Added safe concurrent containers
Swoole\Thread\Map
,Swoole\Thread\ArrayList
,Swoole\Thread\Queue
. @matyhtf - The file asynchronous operation supports using
io_uring
as the underlying engine for file asynchronous operations. When liburing is installed and Swoole is compiled with the --enable-iouring option, the asynchronous operations of functions such as file_get_contents, file_put_contents, fopen, fclose, fread, fwrite, mkdir, unlink, fsync, fdatasync, rename, fstat, lstat, and filesize will be implemented by io_uring. @matyhtf @NathanFreeman - Upgraded
Boost Context
to version 1.84. Now, Loongson CPUs can also support coroutines. @NathanFreeman - Added
Swoole\Thread\Map::find()
method. @matyhtf - Added
Swoole\Thread\ArrayList::find()
method. @matyhtf - Added
Swoole\Thread\ArrayList::offsetUnset()
method. @matyhtf - Added
Swoole\Process::getAffinity()
method. @matyhtf - Added
Swoole\Thread::setName()
method. @matyhtf - Added
Swoole\Thread::setAffinity()
method. @matyhtf - Added
Swoole\Thread::getAffinity()
method. @matyhtf - Added
Swoole\Thread::setPriority()
method. @matyhtf - Added
Swoole\Thread::getPriority()
method. @matyhtf - Added
Swoole\Thread::gettid()
method. - The file asynchronous engine
iouring
supports multi-threaded polling modeIORING_SETUP_SQPOLL
. @NathanFreeman - Added
iouring_workers
to modify the number ofiouring
threads. @NathanFreeman - Added
iouring_flags
to support modifying theiouring
working mode. @NathanFreeman - Added
Swoole\Thread\Barrier
for multi-thread synchronization barrier. @matyhtf - Added new function and class to set cookies. @matyhtf @NathanFreeman
- Added
non-blocking, reentrant coroutine mutex lock
, which can be used between processes/threads without blocking them. @NathanFreeman Swoole\Coroutine\Socket::getOption()
supports theTCP_INFO
option. @matyhtfSwoole\Client
synchronous blocking client supportshttp
proxy. @matyhtf- Added asynchronous non-blocking
TCP/UDP/Unix socket
clientSwoole\Async\Client
. @matyhtf - Optimized the
Swoole\Redis\Server::format()
method to support zero-copy memory, supportredis
nested structure. @matyhtf - Supports the high-performance compression tool
Zstd
. You only need to add--enable-zstd
when compilingSwoole
, and thenzstd
can be used to compress or decode responses between thehttp
client and server. @NathanFreeman
🐛 Bug Fixed:
- Fixed the issue where installation via
pecl
was not possible. @remicollet - Fixed the bug where setting
keepalive
was not possible forSwoole\Coroutine\FastCGI\Client
. @NathanFreeman - Fixed the issue where exceeding the
max_input_vars
would throw an error, causing the process to restart repeatedly. @NathanFreeman - Fixed unknown issues caused by using
Swoole\Event::wait()
within a coroutine. @matyhtf - Fixed the problem where
proc_open
does not support pty in coroutine mode. @matyhtf - Fixed segmentation fault issues with
pdo_sqlite
on PHP 8.3. @NathanFreeman - Fixed unnecessary warnings during the compilation of
Swoole
. @Appla @NathanFreeward - Fixed the error thrown by zend_fetch_resource2_ex when
STDOUT/STDERR
are already closed. @Appla @matyhtf - Fixed ineffective
set_tcp_nodelay
configuration. @matyhtf - Fixed the occasional unreachable branch issue during file upload. @NathanFreeman
- Fixed the problem where setting
dispatch_func
would cause PHP's internals to throw errors. @NathanFreeman - Fixed the deprecation of AC_PROG_CC_C99 in autoconf >= 2.70. @petk
- Capture exceptions when thread creation fails. @matyhtf
- Fixed the undefined problem with
_tsrm_ls_cache
. @jingjingxyk - Fixed the fatal compile error with
GCC 14
. @remicollet - Fixed the dynamic property issue in
Swoole\Http2\Request
. @guandeng - Fixed the occasional resource unavailability issue in the
pgsql
coroutine client. @NathanFreeman - Fixed the issue of 503 errors due to not resetting related parameters during process restart. @matyhtf
- Fixed the inconsistency between
$request->server['request_method']
and$request->getMethod()
whenHTTP2
is enabled. @matyhtf - Fixed incorrect
content-type
when uploading files. @matyhtf - Fixed code errors in the
http2
coroutine client. @matyhtf - Fixed the missing
worker_id
property inSwoole\Server
. @cjavad - Fixed errors related to
brotli
inconfig.m4
. @fundawang - Fixed the invalid
Swoole\Http\Response::create
under multi-threading. @matyhtf - Fixed compilation errors in the
macos
environment. @matyhtf - Fixed the issue of threads not being able to exit safely. @matyhtf
- Fixed the issue where the static variable for response time returned by
Swoole\Http\Response
in multi-threaded mode was not generated separately for each thread. @matyhtf @NathanFreeman - Fixed
Fatal error
issue caused byPHP-8.4
'stimeout
feature in ZTS mode. @matyhtf - Fixed compatibility issue with the
exit()
hook
function forPHP-8.4
. @remicollet - Fixed the issue where
Swoole\Thread::getNativeId()
did not work incygwin
. @matyhtf - Fixed the issue causing
SIGSEGV
inSwoole\Coroutine::getaddrinfo()
method. @matyhtf - Fixed the issue where the runtime TCP module did not support dynamically enabling SSL encryption. @matyhtf
- Fixed the issue where the HTTP client had an incorrect timeout after running for a long time. @matyhtf
- Fixed the problem where the mutex lock of
Swoole\Table
could not be used before the process exited. @matyhtf - Fixed the failure of
Swoole\Server::stop()
when using named parameters. @matyhtf - Fixed the crash caused by
Swoole\Thread\Map::toArray()
not copying the key. @matyhtf - Fixed the issue of being unable to delete nested numeric keys in
Swoole\Thread\Map
. @matyhtf
⭐️ Kernel optimization:
- Removed unnecessary checks for
socket structs
. @petk - Upgraded Swoole Library. @deminy
- Added support for status code 451 in
Swoole\Http\Response
. @abnegate - Synchronized
file
operation code across different PHP versions. @NathanFreeman - Synchronized
pdo
operation code across different PHP versions. @NathanFreeman - Optimized the code for
Socket::ssl_recv()
. @matyhtf - Improved config.m4; some configurations can now set library locations via
pkg-config
. @NathanFreeman - Optimized the use of dynamic arrays during
request header parsing
. @NathanFreeman - Optimized file descriptor
fd
lifecycle issues in multi-threading mode. @matyhtf - Optimized some fundamental coroutine logic. @matyhtf
- Upgraded the Oracle database version for CI testing. @gvenzl
- Optimized the underlying logic of
sendfile
. @matyhtf - Replaced
PHP_DEF_HAVE
withAC_DEFINE_UNQUOTED
inconfig.m4
. @petk - Optimized the logic related to
heartbeat
,shutdown
, andstop
for the server in multi-threaded mode. @matyhtf - Optimized to avoid linking
librt
whenglibc
version is greater than 2.17. @matyhtf - Enhanced the HTTP client to accept duplicate request headers. @matyhtf
- Optimized
Swoole\Http\Response::write()
. @matyhtf Swoole\Http\Response::write()
can now send HTTP/2 protocol. @matyhtf- Compatible with
PHP 8.4
. @matyhtf @NathanFreeman - Added the ability for asynchronous writing at the underlying socket level. @matyhtf
- Optimized
Swoole\Http\Response
. @NathanFreeman - Improved underlying error messages. @matyhtf
- Supported sharing PHP native sockets in multi-threaded mode. @matyhtf
- Optimized static file service and fixed static file path error issues. @matyhtf
- Multi-thread mode
SWOOLE_THREAD
supports restarting worker threads. @matyhtf - Multi-thread mode
SWOOLE_THREAD
supports starting timers in theManager
thread. @matyhtf - Compatible with the
curl
extension ofPHP-8.4
. @matyhtf @NathanFreeman - Rewrite the underlying
Swoole
code usingiouring
. @matyhtf @NathanFreeman - Optimized timers so that synchronous processes do not depend on signals. @matyhtf
- Optimized the
Swoole\Coroutine\System::waitSignal()
method to allow listening to multiple signals simultaneously. @matyhtf
❌ Deprecated:
- No longer supports
PHP 8.0
. - No longer supports
Swoole\Coroutine\MySQL
coroutine client. - No longer supports
Swoole\Coroutine\Redis
coroutine client. - No longer supports
Swoole\Coroutine\PostgreSQL
coroutine client. - Removed
Swoole\Coroutine\System::fread()
,Swoole\Coroutine\System::fwrite()
, andSwoole\Coroutine\System::fgets()
methods.
😊 Thank you
- Thank you for your contribution to Swoole v6.0.0. Wish you good health, all the best, and smooth work.
✨ 新特性:
Swoole
支持多线程模式,当php
是zts
模式,编译Swoole
时开启--enable-swoole-thread
时,就能使用多线程模式。- 新增创建线程类
Swoole\Thread
。 @matyhtf - 新增线程锁
Swoole\Thread\Lock
。 @matyhtf - 新增线程原子计数
Swoole\Thread\Atomic
,Swoole\Thread\Atomic\Long
。 @matyhtf - 新增安全并发容器
Swoole\Thread\Map
,Swoole\Thread\ArrayList
,Swoole\Thread\Queue
。 @matyhtf - 文件异步操作支持了使用
iouring作为文件异步操作的底层引擎
,安装了liburing
和编译Swoole
时开启--enable-iouring
,file_get_contents
,file_put_contents
,fopen
,fclose
,fread
,fwrite
,mkdir
,unlink
,fsync
,fdatasync
,rename
,fstat
,lstat
,filesize
这些函数的异步操作将会由iouring
实现。 @matyhtf @NathanFreeman - 升级
Boost Context
版本到1.84。现在,龙芯CPU也能够支持协程了。 @NathanFreeman - 新增
Swoole\Thread\Map::find()
方法。 @matyhtf - 新增
Swoole\Thread\ArrayList::find()
方法。 @matyhtf - 新增
Swoole\Thread\ArrayList::offsetUnset()
方法。 @matyhtf - 新增
Swoole\Process::getAffinity()
方法。 @matyhtf - 新增
Swoole\Thread::setName()
方法。 @matyhtf - 新增
Swoole\Thread::setAffinity()
方法。 @matyhtf - 新增
Swoole\Thread::getAffinity()
方法。 ...
v5.1.6
🐛 Bug Fixes:
- Fixed the issue where
Swoole\Http\Response::end()
returnsnull
. @NathanFreeman - Fixed the problem where the mutex lock of
Swoole\Table
could not be used before the process exits. @matyhtf - Fixed the failure of
Swoole\Server::stop()
caused by using named parameters. @matyhtf - Fixed the issue where the
runtime tcp
module did not support dynamically enabling SSL encryption. @matyhtf - Fixed the
Fatal error
issue caused by the timeout feature ofPHP
inZTS
mode. @matyhtf - Fixed the problem where
Swoole\Coroutine::getaddrinfo()
method could lead to SIGSEGV. @matyhtf - Fixed the issue where the HTTP client running for a long time resulted in incorrect timeout settings. @matyhtf
⛔ Warning:
- The
v5.1.x
version does not supportPHP-8.4
. If you want to useSwoole
withPHP-8.4
, please use the6.0
version.
😊 Thank you:
- Thank you for your contributions to
Swoole v5.1.6
. Wishing everyone good health, all the best, and smooth work.
🐛 Bug修复:
- 修复
Swoole\Http\Response::end()
返回null
的问题。 @NathanFreeman - 修复进程退出之前会导致
Swoole\Table
的互斥锁无法使用的问题。 @matyhtf - 修复使用命名参数导致
Swoole\Server::stop()
执行失败的问题。 @matyhtf - 修复
runtime tcp
模块不支持动态开启SSL加密的问题。 @matyhtf - 修复
PHP
在ZTS
模式下的超时特性引起的Fatal error
问题。 @matyhtf - 修复Swoole\Coroutine::getaddrinfo()方法会导致SIGSEGV的问题。 @matyhtf
- 修复http客户端长时间运行导致超时时间不正确的问题。 @matyhtf
⛔ 注意:
v5.1.*
版本不支持PHP-8.4
,如果想在PHP-8.4
中使用Swoole
,请使用v6.0
版本。
😊 致谢:
- 感谢你们为
Swoole v5.1.6
做出的贡献,祝愿大家身体健康,万事如意,工作顺利。
v6.0.0-rc1
✨ New Features:
- Added
non-blocking, reentrant coroutine mutex lock
, which can be used between processes/threads without blocking them. @NathanFreeman Swoole\Coroutine\Socket::getOption()
supports theTCP_INFO
option. @matyhtfSwoole\Client
synchronous blocking client supportshttp
proxy. @matyhtf- Added asynchronous non-blocking
TCP/UDP/Unix socket
clientSwoole\Async\Client
. @matyhtf - Optimized the
Swoole\Redis\Server::format()
method to support zero-copy memory, supportredis
nested structure. @matyhtf
🐛 Bug Fixes:
- Fixed
Fatal error
issue caused byPHP-8.4
'stimeout
feature in ZTS mode. @matyhtf - Fixed compatibility issue with the
exit()
hook
function forPHP-8.4
. @remicollet - Fixed the issue where
Swoole\Thread::getNativeId()
did not work incygwin
. @matyhtf - Fixed the issue causing
SIGSEGV
inSwoole\Coroutine::getaddrinfo()
method. @matyhtf - Fixed the issue where the runtime TCP module did not support dynamically enabling SSL encryption. @matyhtf
- Fixed the issue where the HTTP client had an incorrect timeout after running for a long time. @matyhtf
- Fixed the problem where the mutex lock of
Swoole\Table
could not be used before the process exited. @matyhtf - Fixed the failure of
Swoole\Server::stop()
when using named parameters. @matyhtf - Fixed the crash caused by
Swoole\Thread\Map::toArray()
not copying the key. @matyhtf - Fixed the issue of being unable to delete nested numeric keys in
Swoole\Thread\Map
. @matyhtf
⭐️ Kernel Optimization:
- Multi-thread mode
SWOOLE_THREAD
supports restarting worker threads. @matyhtf - Multi-thread mode
SWOOLE_THREAD
supports starting timers in theManager
thread. @matyhtf - Compatible with the
curl
extension ofPHP-8.4
. @matyhtf @NathanFreeman - Refactored
iouring
. @matyhtf @NathanFreeman - Optimized timers so that synchronous processes do not depend on signals. @matyhtf
- Optimized the
Swoole\Coroutine\System::waitSignal()
method to allow listening to multiple signals simultaneously. @matyhtf
😊 Thank you:
- Thank you for your contributions to
Swoole v6.0.0
. Wishing everyone good health, happiness, and success in your work.
⛔️ Warning:
- This version is a
pre-release
and should not be used in production environments, only in testing environments.
✨️ 新特性:
- 新增`非阻塞,可重入的互斥协程锁”,该锁可以在进程间/线程间使用,且不会阻塞进程/线程。 @NathanFreeman
Swoole\Coroutine\Socket::getOption()
支持了TCP_INFO
选项。 @matyhtfSwoole\Client
同步阻塞客户端支持http
代理。 @matyhtf- 新增异步非阻塞的
TCP/UDP/Unixsocket
客户端Swoole\Async\Client
。 @matyhtf - 优化
Swoole\Redis\Server::format
()方法,支持内存零拷贝,支持redis
嵌套结构。 @matyhtf
🐛 Bug修复:
- 修复因为
PHP-8.4
在ZTS模式下的超时
特性引起的Fatal error
问题。 @matyhtf - 修复
PHP-8.4
的exit()
函数hook
。 @remicollet - 修复
Swoole\Thread::getNativeId()
在cygwin
无法工作的问题。 @matyhtf - 修复
Swoole\Coroutine::getaddrinfo()
方法会导致SIGSEGV
的问题。 @matyhtf - 修复
runtime tcp
模块不支持动态开启SSL加密的问题。 @matyhtf - 修复http客户端长时间运行导致超时时间不正确的问题。 @matyhtf
- 修复进程退出之前会导致
Swoole\Table
的互斥锁无法使用的问题。 @matyhtf - 修复使用命名参数导致
Swoole\Server::stop()
执行失败的问题。 @matyhtf - 修复
Swoole\Thread\Map::toArray()
函数未复制key
导致崩溃的问题。 @matyhtf - 修复
Swoole\Thread\Map
无法删除嵌套的数字键的问题。 @matyhtf
⭐️ 内核优化:
- 异步
Server
多线程模式支持重启工作线程。 @matyhtf - 异步
Server
多线程模式支持在Manager
线程中开启定时器。 @matyhtf - 兼容
PHP-8.4
的curl
扩展。 @matyhtf @NathanFreeman - 重构
iouring
。 @matyhtf @NathanFreeman - 优化定时器,使同步进程不依赖于信号。 @matyhtf
- 优化
Swoole\Coroutine\System::waitSignal()
方法,允许同时监听多个信号。 @matyhtf
😊 致谢:
- 感谢你们为
Swoole v6.0.0
做出的贡献,祝愿大家身体健康,万事如意,工作顺利。
⛔️ 警告:
- 目前该版本是预发布版本,禁止在生产环境中使用,只能用于测试环境。
v5.1.5
🐛 Bug Fixes:
- Fix the need to use
zend_ini_parse_quantity
to parse string numbers for PHP versions greater than 8.2. @matyhtf - Fix an occasional resource unavailability issue when coroutineizing
pdo_pgsql
. @NathanFreeman - Fix header file reference issues when coroutineizing
pdo_pgsql
. @NathanFreeman - Fix incorrect relative path checks to avoid bypassing path validation. @matyhtf
- Fix incorrect concurrency count caused by process restarts in high-concurrency environments. @matyhtf
⭐️ Kernel Optimization:
- Sync some related code for
php8.3 curl
. @NathanFreeman - Fix core test errors in the
process
module. @NathanFreeman - In
SWOOLE_BASE
mode, all connections should be closed during thePHP RSHUTDOWN
phase. @matyhtf - Optimize kernel code. @matyhtf
😊 Thank you
- Thank you for your contribution to Swoole v6.0.0. Wish you good health, all the best, and smooth work.
🐛 Bug修复:
- 修复php版本大于8.2,需要使用
zend_ini_parse_quantity
解析字符串数字。 @matyhtf - 修复
pdo_pgsql
协程化的时候,偶发资源不可用的问题。 @NathanFreeman - 修复
pdo_pgsql
协程化的时候,头文件引用问题。 @NathanFreeman - 修复不正确的相对路径检查,以避免绕过路径验证。 @matyhtf
- 修复高并发环境下,进程重启会导致并发数不正确。 @matyhtf
⭐️ 内核优化:
- 同步
php8.3 curl
的一些相关代码。 @NathanFreeman - 修复
process
模块核心测试错误。 @NathanFreeman - 在
SWOOLE_BASE
模式下,所有的连接都应该在PHP RSHUTDOWN
阶段都被关闭。 @matyhtf - 优化内核代码。 @matyhtf
😊 致谢
- 感谢你们为Swoole v5.1.5做出的贡献,祝愿大家身体健康,万事如意,工作顺利。
v6.0.0-beta
✨ New Feature:
- Added
Swoole\Thread\Map::find()
method. @matyhtf - Added
Swoole\Thread\ArrayList::find()
method. @matyhtf - Added
Swoole\Thread\ArrayList::offsetUnset()
method. @matyhtf - Added
Swoole\Process::getAffinity()
method. @matyhtf - Added
Swoole\Thread::setName()
method. @matyhtf - Added
Swoole\Thread::setAffinity()
method. @matyhtf - Added
Swoole\Thread::getAffinity()
method. @matyhtf - Added
Swoole\Thread::setPriority()
method. @matyhtf - Added
Swoole\Thread::getPriority()
method. @matyhtf - Added
Swoole\Thread::gettid()
method. - The file asynchronous engine
iouring
supports multi-threaded polling modeIORING_SETUP_SQPOLL
. @NathanFreeman - Added
iouring_workers
to modify the number ofiouring
threads. @NathanFreeman - Added
iouring_flags
to support modifying theiouring
working mode. @NathanFreeman - Added
Swoole\Thread\Barrier
for multi-thread synchronization barrier. @matyhtf - Added new function and class to set cookies. @matyhtf @NathanFreeman
New Cookie API
$server->on('request', function (Swoole\Http\Request $request, Swoole\Http\Response $response) use ($pm) {
$cookie = new Swoole\Http\Cookie();
$cookie->withName('key1')
->withValue('val1')
->withExpires(time() + 84600)
->withPath('/')
->withDomain('id.test.com')
->withSecure(true)
->withHttpOnly(true)
->withSameSite('None')
->withPriority('High')
->withPartitioned(true);
$response->setCookie($cookie);
$response->end("<h1>Hello Swoole. #" . rand(1000, 9999) . "</h1>");
});
🐛 Bug Fixed:
- Fixed the dynamic property issue in
Swoole\Http2\Request
. @guandeng - Fixed the occasional resource unavailability issue in the
pgsql
coroutine client. @NathanFreeman - Fixed the issue of 503 errors due to not resetting related parameters during process restart. @matyhtf
- Fixed the inconsistency between
$request->server['request_method']
and$request->getMethod()
whenHTTP2
is enabled. @matyhtf - Fixed incorrect
content-type
when uploading files. @matyhtf - Fixed code errors in the
http2
coroutine client. @matyhtf - Fixed the missing
worker_id
property inSwoole\Server
. @cjavad - Fixed errors related to
brotli
inconfig.m4
. @fundawang - Fixed the invalid
Swoole\Http\Response::create
under multi-threading. @matyhtf - Fixed compilation errors in the
macos
environment. @matyhtf - Fixed the issue of threads not being able to exit safely. @matyhtf
- Fixed the issue where the static variable for response time returned by
Swoole\Http\Response
in multi-threaded mode was not generated separately for each thread. @matyhtf @NathanFreeman
⭐️ Kernel Optimization:
- Upgraded the Oracle database version for CI testing. @gvenzl
- Refactored and optimized the underlying related code of
swoole
. @matyhtf - Optimized the underlying logic of
sendfile
. @matyhtf - Optimized parameter parsing. @matyhtf
- Replaced
PHP_DEF_HAVE
withAC_DEFINE_UNQUOTED
inconfig.m4
. @petk - Optimized the logic related to
heartbeat
,shutdown
, andstop
for the server in multi-threaded mode. @matyhtf - Optimized to avoid linking
librt
whenglibc
version is greater than 2.17. @matyhtf - Enhanced the HTTP client to accept duplicate request headers. @matyhtf
- Optimized
Swoole\Http\Response::write()
. @matyhtf Swoole\Http\Response::write()
can now send HTTP/2 protocol. @matyhtf- Compatible with
PHP 8.4
. @matyhtf @NathanFreeman - Added the ability for asynchronous writing at the underlying socket level. @matyhtf
- Optimized
Swoole\Http\Response
. @NathanFreeman - Improved underlying error messages. @matyhtf
- Supported sharing PHP native sockets in multi-threaded mode. @matyhtf
- Optimized static file service and fixed static file path error issues. @matyhtf
❌ Deprecated:
- Removed
Swoole\Coroutine\System::fread()
,Swoole\Coroutine\System::fwrite()
, andSwoole\Coroutine\System::fgets()
methods.
😊 Thank you
- Thank you for your contribution to Swoole v6.0.0. Wish you good health, all the best, and smooth work.
✨ 新特性:
- 新增
Swoole\Thread\Map::find()
方法。 @matyhtf - 新增
Swoole\Thread\ArrayList::find()
方法。 @matyhtf - 新增
Swoole\Thread\ArrayList::offsetUnset()
方法。 @matyhtf - 新增
Swoole\Process::getAffinity()
方法。 @matyhtf - 新增
Swoole\Thread::setName()
方法。 @matyhtf - 新增
Swoole\Thread::setAffinity()
方法。 @matyhtf - 新增
Swoole\Thread::getAffinity()
方法。 @matyhtf - 新增
Swoole\Thread::setPriority()
方法。 @matyhtf - 新增
Swoole\Thread::getPriority()
方法。 @matyhtf - 新增
Swoole\Thread::gettid()
方法。 - 文件异步引擎
iouring
支持多线程轮询模式IORING_SETUP_SQPOLL
。 @NathanFreeman - 新增
iouring_workers
修改iouring
线程数。 @NathanFreeman - 新增
iouring_flags
支持修改iouring
工作模式。 @NathanFreeman - 增加
Swoole\Thead\Barrier
多线程同步屏障。@matyhtf - 增加新的设置cookie的函数。 @matyhtf @NathanFreeman
🐛 Bug修复:
- 修复
Swoole\Http2\Request
动态属性问题。 @guandeng - 修复
pgsql
协程客户端偶发资源不可用的问题。 @NathanFreeman - 修复进程重启,没有重置相关参数导致503错误的问题。@matyhtf
- 修复开启
HTTP2
时,$request->server['request_method'] 与 $request->getMethod() 的结果不一致。 @matyhtf - 修复上传文件时,不正确的
content-type
。 @matyhtf - 修复
http2
协程客户端的代码错误。 @matyhtf - 修复
Swoole\Server
缺少属性worker_id
的问题。 @cjavad - 修复
config.m4
有关brotli
错误的问题。 @fundawang - 修复 多线程下
Swoole\Http\Response::create
无效。 @matyhtf - 修复
macos
环境下编译错误。 @matyhtf - 修复线程无法安全退出的问题。 @matyhtf
- 修复多线程模式下,
Swoole\Http\Response
返回响应时间的静态变量没有各个线程各自生成一份的问题。 @matyhtf @NathanFreeman
⭐️ 内核优化:
- 升级CI测试的oracle数据库版本。 @gvenzl
- 重构优化
swoole
底层相关代码。 @matyhtf - 优化底层
sendfile
的相关逻辑。 @matyhtf - 优化参数解析。 @matyhtf
config.m4
中用AC_DEFINE_UNQUOTED
替换PHP_DEF_HAVE
。 @petk- 优化多线程模式下,server的
heartbeat
,shutdown
和stop
的相关逻辑。 @matyhtf - 优化
glibc
版本高于2.17时,不需要链接librt
。 @matyhtf - 加强
http
客户端可以接受重复的请求头。 @matyhtf - 优化
Swoole\Http\Response::write()
。 @matyhtf Swoole\Http\Response::write()
现在可以发送http2
协议。 @matyhtf- 兼容
PHP8.4
。 @matyhtf @NathanFreeman - 增加底层
socket
异步写入的能力。 @matyhtf - 优化
Swoole\Http\Response
。 @NathanFreeman - 优化底层错误信息。 @matyhtf
- 多线程模式下,支持共享php原生
socket
。 @matyhtf - 优化静态文件服务,修复静态文件路径错误问题。 @matyhtf
❌ 废弃:
- 移除
Swoole\Coroutine\System::fread()
,Swoole\Coroutine\System::fwrite()
和Swoole\Coroutine\System::fgets()
方法
😊 致谢
- 感谢你们为Swoole v6.0.0做出的贡献,祝愿大家身体健康,万事如意,工作顺利。