github swoole/swoole-src v6.1.2

13 hours ago
  • No longer throw warnings when failing to set the socket receive/send buffer size
  • Fixed an issue in Swoole\Http\Server where the onClose callback might execute before onRequest when handling HTTP2 requests, leading to a use-after-free problem
  • Optimized the getSocket() method by duplicating the file descriptor when exporting the php sockets resource object, preventing php sockets from affecting the socket held by Swoole upon closure
  • Fixed a memory leak issue in Swoole\Async\Client
  • Fixed an issue where Swoole\Coroutine\Http\Client of IPv6 type could not use Socks5 proxy
  • Synchronized updates to adapt to relevant changes in the CURL extension in PHP 8.4
  • Added the async.file:// file protocol, which allows enabling coroutine scheduling for specific file operations even when global file coroutine support is disabled
use function Swoole\Coroutine\run;

// Disable global file coroutine support but enable coroutine operations for specific files via the `async.file://` protocol  
Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE);

run(function() {
    $fp = fopen("async.file:///home/test", "r");
    fwrite($fp, "data");
    fclose($fp);

   $content = file_get_contents("async.file:///home/test.txt");
});

This feature is designed for scenarios where global file system coroutine HOOK is disabled, but asynchronous read/write scheduling is required for specific file operations.

简体中文

  • 设置 socket 接收/发送缓冲区尺寸失败时不再抛出警告
  • 修复 Swoole\Http\Server 处理 HTTP2 请求时,onClose 回调可能先于 onRequest 执行,导致释放后使用(use-after-free)的问题
  • 优化getSocket()方法,导出php sockets资源对象时复制文件描述符,避免php sockets 关闭时影响 Swoole 持有的socket
  • 修复 Swoole\Async\Client 内存泄漏问题
  • 修复 IPv6 类型 Swoole\Coroutine\Http\Client 无法使用 Socks5 代理的问题
  • 同步适配 PHP 8.4CURL 扩展的相关更新
  • 新增 async.file:// 文件协议,支持在未开启全局文件协程化时,对指定文件操作启用协程调度
use function Swoole\Coroutine\run;

// 禁用全局文件协程化,但可通过 `async.file://` 协议对特定文件启用协程操作
Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE);

run(function() {
    $fp = fopen("async.file:///home/test", "r");
    fwrite($fp, "data");
    fclose($fp);

   $content = file_get_contents("async.file:///home/test.txt");
});

该特性用于在禁用全局文件系统协程 HOOK后,对部分文件操作进行异步读写调用的场景。

Don't miss a new swoole-src release

NewReleases is sending notifications on new releases.