6
头图

In Swoole official website adds online operation button, you can run some sample code provided directly home, of course, you can manually export some PHP test the code.

You can visit the homepage of Swoole official website for testing and use: https://www.swoole.com/

It is still in the testing stage. If you encounter BUG you can give feedback to Seewo Technology's customer service or communication group.

Imprint

Before the official release, some new features and functions have been published in articles to explain, so I will not repeat them here, you can check:

Explain some other modifications:

  • Prohibit Hook functions that have been disabled by PHP

In the previous version, if the method is disabled disable_functions , it can still be called normally after HOOK

The following code:

var_dump(`ls`);

Swoole\Coroutine\run(function () {
    var_dump(`ls`);
});

Save to test.php , use php -d disable_functions=shell_exec test.php execute the command line

The output of the previous version is:

PHP Warning:  shell_exec() has been disabled for security reasons in /Users/lufei/Swoole/test.php on line 3
NULL
string(11) "swoole.php
"

After upgrading to v4.7.0 , the behavior is the same as before HOOK.

PHP Warning:  shell_exec() has been disabled for security reasons in /Users/lufei/Swoole/test.php on line 3
NULL
PHP Warning:  shell_exec() has been disabled for security reasons in /Users/lufei/Swoole/test.php on line 6
NULL
  • Coroutine\go() method has increased the return value

Coroutine\go() method used in the previous version will not return the coroutine ID. The v4.7.0 to return the current coroutine ID.

use Swoole\Coroutine\System;
use function Swoole\Coroutine\run;
use function Swoole\Coroutine\go;

run(function () {
    $cid = go(function() {
        System::sleep(0.001);
    });
    var_dump($cid);
});
  • Added the build in Cygwin

Starting from the v4.7.0 Cygwin version compressed package of this version can be obtained from the GitHub release

Update log

The following is the complete update log:

New API

  • Add Process\Pool::detach() method (#4221) (@matyhtf)
  • Server supports onDisconnect callback function (#4230) (@matyhtf)
  • Added Coroutine::cancel() and Coroutine::isCanceled() methods (#4247) (#4249) (@matyhtf)
  • Http\Client supports http_compression and body_decompression options (#4299) (@matyhtf)

Enhance

  • Support the strict type of field when the coroutine MySQL client is in prepare (#4238) (@Yurunsoft)
  • DNS support c-ares library (#4275) (@matyhtf)
  • Server supports configuring heartbeat detection time for different ports when multi-port monitoring (#4290) (@matyhtf)
  • Server of dispatch_mode supports SWOOLE_DISPATCH_CO_CONN_LB and SWOOLE_DISPATCH_CO_REQ_LB modes (#4318) (@matyhtf)
  • ConnectionPool::get() supports timeout parameters (swoole/library#108) (@leocavalcante)
  • Hook Curl supports CURLOPT_PRIVATE option (swoole/library#112) (@sy-records)
  • Optimize PDOStatementProxy::setFetchMode() method (swoole/library#109) (@yespire)

repair

  • Fix the exception of failing to create threads when creating a large number of coroutines when using thread context (8ce5041) (@matyhtf)
  • Fix the problem that the php_swoole.h header file is missing when installing Swoole (#4239) (@sy-records)
  • Fix EVENT_HANDSHAKE incompatibility issue (#4248) (@sy-records)
  • Fix the problem that the SW_LOCK_CHECK_RETURN macro may call the function twice (#4302) (@zmyWL)
  • Fix the Atomic\Long under M1 chip (e6fae2e) (@matyhtf)
  • Fix the Coroutine\go() missing return value for 060f15fb9e3e63 (swoole/library@1ed49db) (@matyhtf)
  • Fix StringObject return value type problem (swoole/library#111) (swoole/library#113) (@leocavalcante) (@sy-records)

Kernel

  • Prohibit Hook functions that have been disabled by PHP (#4283) (@twose)

test

  • Added Cygwin environment construction (#4222) (@sy-records)
  • Added alpine 3.13 and 3.14 (#4309) (@limingxinleo)


沈唁
1.9k 声望1.2k 粉丝