Code Monkey home page Code Monkey logo

openswoole's Introduction

openswoole's People

Contributors

alijvhr avatar compwright avatar digibeuk avatar doubaokun avatar jsanahuja avatar lotharthesavior avatar matieuszpl avatar mesolonely avatar mrvralex avatar percybolmer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openswoole's Issues

Psr Message definition not respected to read multiple header values

The MessageInterface states that

  • getHeaderLine will return a string
  • getHeader will return an array

The Psr implementation in OpenSwoole always returns a string, making it incompatible with 3rd party libraries expecting Psr format.

Workaround: add and extra middleware to wrap the request.

SNMP library blocks Coroutine

Good day. Help to understand, the php-snmp library is not supported by Swoole Coroutine ? Because asynchrony is blocked, and requests are executed in turn.
But work in tests like sleep, exec, file_get_contents, etc.

Maybe there is a solution to solve this issue?
Thanks

<?php
use function Swoole\Coroutine\go;
use function Swoole\Coroutine\run;

run(function () {
    for ($i = 1; $i < 100; ++$i) {
        go(function () use ($i) {
            $snmp = new \SNMP(\SNMP::VERSION_2c, '10.10.0.' . $i, 'public');
            $snmp->get('.1.3.6.1.2.1.1.3.0');
            var_dump($snmp);
        });
    }
});

OpenSwoole should always respect a HTTP status code being set regardless of reason text being provided.

According to the documentation, if a reason is not provided but I have a custom status code, openswoole would reset it to 200.

If an invalid status code is set, OpenSwoole will reset the value to 200. However, if a HTTP status code $reason is given, you may set any status code such as 499 or 856.

This is very obtuse behaviour and one that has caused some production issues. We use Swoole with Laravel and it does not provide an easy way to respond with reason text in a consistent way.

OpenSwoole should always respect a HTTP status code being set. a 599 should not be translated into a 200 ok.

PHP error when parsing header with PSR7 handler

I'm getting the following error after upgrading to v22:

Warning:  implode(): Invalid arguments passed in vendor/openswoole/core/src/Psr/Message.php on line 65
Stack trace:
  1. {main}() bin/graphqld:0
  2. OpenSwoole\Server->start() bin/graphqld:29
  3. OpenSwoole\Core\Helper::OpenSwoole\Core\{closure:vendor/openswoole/core/src/Helper.php:27-31}($request = class OpenSwoole\Http\Request { public $fd = 1; public $streamId = 0; public $header = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; public $server = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; public $cookie = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; public $get = NULL; public $files = NULL; public $post = NULL; public $tmpfiles = NULL }, $response = class OpenSwoole\Http\Response { public $fd = 1; public $socket = NULL; public $header = NULL; public $cookie = NULL; public $trailer = NULL }) bin/graphqld:29
  4. Relay\Relay->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = []; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/openswoole/core/src/Helper.php:29
  5. Relay\Runner->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = []; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/relay/relay/src/Relay.php:20
  6. Middlewares\AccessLog->process($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = []; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }, $handler = class Relay\Runner { protected $queue = [0 => class Middlewares\AccessLog { ... }, 1 => class App\Graphql\Server\Middleware\BeforeAfterMiddleware { ... }, 2 => class Compwright\PhpSession\Middleware\SessionCookieMiddleware { ... }, 3 => class Compwright\PhpSession\Middleware\SessionMiddleware { ... }, 4 => class Compwright\PhpSession\Middleware\SessionCacheControlMiddleware { ... }, 5 => class Middlewares\JsonPayload { ... }, 6 => class Middlewares\FastRoute { ... }, 7 => class Middlewares\RequestHandler { ... }]; protected $resolver = class Closure { virtual $closure = "$this->Relay\{closure}", public $this = class Relay\Relay { ... }; public $parameter = [...] } }) vendor/relay/relay/src/Runner.php:29
  7. Relay\Runner->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = []; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/middlewares/access-log/src/AccessLog.php:115
  8. App\Graphql\Server\Middleware\BeforeAfterMiddleware->process($serverRequest = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = []; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }, $handler = class Relay\Runner { protected $queue = [0 => class Middlewares\AccessLog { ... }, 1 => class App\Graphql\Server\Middleware\BeforeAfterMiddleware { ... }, 2 => class Compwright\PhpSession\Middleware\SessionCookieMiddleware { ... }, 3 => class Compwright\PhpSession\Middleware\SessionMiddleware { ... }, 4 => class Compwright\PhpSession\Middleware\SessionCacheControlMiddleware { ... }, 5 => class Middlewares\JsonPayload { ... }, 6 => class Middlewares\FastRoute { ... }, 7 => class Middlewares\RequestHandler { ... }]; protected $resolver = class Closure { virtual $closure = "$this->Relay\{closure}", public $this = class Relay\Relay { ... }; public $parameter = [...] } }) vendor/relay/relay/src/Runner.php:29
  9. Relay\Runner->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) src/Graphql/Server/Middleware/BeforeAfterMiddleware.php:36
 10. Compwright\PhpSession\Middleware\SessionCookieMiddleware->process($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }, $handler = class Relay\Runner { protected $queue = [0 => class Middlewares\AccessLog { ... }, 1 => class App\Graphql\Server\Middleware\BeforeAfterMiddleware { ... }, 2 => class Compwright\PhpSession\Middleware\SessionCookieMiddleware { ... }, 3 => class Compwright\PhpSession\Middleware\SessionMiddleware { ... }, 4 => class Compwright\PhpSession\Middleware\SessionCacheControlMiddleware { ... }, 5 => class Middlewares\JsonPayload { ... }, 6 => class Middlewares\FastRoute { ... }, 7 => class Middlewares\RequestHandler { ... }]; protected $resolver = class Closure { virtual $closure = "$this->Relay\{closure}", public $this = class Relay\Relay { ... }; public $parameter = [...] } }) vendor/relay/relay/src/Runner.php:29
 11. Relay\Runner->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/compwright/php-session/src/Middleware/SessionCookieMiddleware.php:34
 12. Compwright\PhpSession\Middleware\SessionMiddleware->process($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }, $handler = class Relay\Runner { protected $queue = [0 => class Middlewares\AccessLog { ... }, 1 => class App\Graphql\Server\Middleware\BeforeAfterMiddleware { ... }, 2 => class Compwright\PhpSession\Middleware\SessionCookieMiddleware { ... }, 3 => class Compwright\PhpSession\Middleware\SessionMiddleware { ... }, 4 => class Compwright\PhpSession\Middleware\SessionCacheControlMiddleware { ... }, 5 => class Middlewares\JsonPayload { ... }, 6 => class Middlewares\FastRoute { ... }, 7 => class Middlewares\RequestHandler { ... }]; protected $resolver = class Closure { virtual $closure = "$this->Relay\{closure}", public $this = class Relay\Relay { ... }; public $parameter = [...] } }) vendor/relay/relay/src/Runner.php:29
 13. Relay\Runner->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }, 'session' => class Compwright\PhpSession\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/compwright/php-session/src/Middleware/SessionMiddleware.php:61
 14. Compwright\PhpSession\Middleware\SessionCacheControlMiddleware->process($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }, 'session' => class Compwright\PhpSession\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }, $handler = class Relay\Runner { protected $queue = [0 => class Middlewares\AccessLog { ... }, 1 => class App\Graphql\Server\Middleware\BeforeAfterMiddleware { ... }, 2 => class Compwright\PhpSession\Middleware\SessionCookieMiddleware { ... }, 3 => class Compwright\PhpSession\Middleware\SessionMiddleware { ... }, 4 => class Compwright\PhpSession\Middleware\SessionCacheControlMiddleware { ... }, 5 => class Middlewares\JsonPayload { ... }, 6 => class Middlewares\FastRoute { ... }, 7 => class Middlewares\RequestHandler { ... }]; protected $resolver = class Closure { virtual $closure = "$this->Relay\{closure}", public $this = class Relay\Relay { ... }; public $parameter = [...] } }) vendor/relay/relay/src/Runner.php:29
 15. Relay\Runner->handle($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }, 'session' => class Compwright\PhpSession\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/compwright/php-session/src/Middleware/SessionCacheControlMiddleware.php:22
 16. Middlewares\Payload->process($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }, 'session' => class Compwright\PhpSession\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }, $handler = class Relay\Runner { protected $queue = [0 => class Middlewares\AccessLog { ... }, 1 => class App\Graphql\Server\Middleware\BeforeAfterMiddleware { ... }, 2 => class Compwright\PhpSession\Middleware\SessionCookieMiddleware { ... }, 3 => class Compwright\PhpSession\Middleware\SessionMiddleware { ... }, 4 => class Compwright\PhpSession\Middleware\SessionCacheControlMiddleware { ... }, 5 => class Middlewares\JsonPayload { ... }, 6 => class Middlewares\FastRoute { ... }, 7 => class Middlewares\RequestHandler { ... }]; protected $resolver = class Closure { virtual $closure = "$this->Relay\{closure}", public $this = class Relay\Relay { ... }; public $parameter = [...] } }) vendor/relay/relay/src/Runner.php:29
 17. Middlewares\Payload->checkRequest($request = class OpenSwoole\Core\Psr\ServerRequest { protected $attributes = ['context' => class App\Graphql\Server\Context { ... }, 'sessionManager' => class App\Session { ... }, 'session' => class Compwright\PhpSession\Session { ... }]; protected $cookieParams = ['__insp_identity' => 'YnJheHRvbkBmdWxrZXJzb25wbHVtYmluZy5jb20=', '__insp_slim' => '1672679795071', 'intercom-device-id-n3ug9dxf' => '0fcc3e9e-0049-4931-9b6d-7963eba89304', 'intercom-session-n3ug9dxf' => 'cFhyYU1ub0JJNDEycExWYTdTbm1ZbDRCRkMrNHZSTWhzcldXQ3JtQVYvWmxCZmdnU0lZZTYrSlFxYnBjUldqZC0tdWVsMzhlTTc2VGcxclF5Sk5rWUVKUT09--f7d6f25fe13d937a7f8816079b3c631ffa4f78a1', '__insp_pad' => '5', '__insp_sid' => '3816318607', '__insp_uid' => '2651960551', '__stripe_mid' => 'fb24b69b-83a9-4ae3-b0bf-9c896d003caee53279', '__stripe_sid' => '229031f1-1801-41a6-ae3a-7c91c3e98ea8a4fe38', '_gcl_au' => '1.1.109243934.1672678509', '__insp_nv' => 'true', '__insp_targlpt' => 'VG8gWW91ciBTdWNjZXNz', '__insp_targlpu' => 'aHR0cHM6Ly9jbGllbnRzLnRveW91cnN1Y2Nlc3MudGVzdC8=', '__insp_wid' => '1511297858', 'PHPSESSID' => '55c050b89ba83b660f7b6a876d34c87e']; protected $serverParams = ['request_method' => 'POST', 'request_uri' => '/api/graphql', 'path_info' => '/api/graphql', 'request_time' => 1672679795, 'request_time_float' => 1672679795.1407, 'server_protocol' => 'HTTP/1.1', 'server_port' => 8000, 'remote_port' => 44124, 'remote_addr' => '127.0.0.1', 'master_time' => 1672679795]; protected $queryParams = []; protected $uploadedFiles = []; protected $parsedBody = NULL; private ${OpenSwoole\Core\Psr\Request}method = 'POST'; private ${OpenSwoole\Core\Psr\Request}uri = class OpenSwoole\Core\Psr\Uri { private $scheme = ''; private $host = ''; private $port = NULL; private $userInfo = ''; private $path = '/api/graphql'; private $query = ''; private $fragment = '' }; private ${OpenSwoole\Core\Psr\Request}requestTarget = NULL; public $headers = ['host' => 'app.test', 'connection' => 'close', 'content-length' => '1085', 'content-type' => 'application/json', 'origin' => 'https://app.test', 'accept-encoding' => 'gzip, deflate, br', 'accept' => '*/*', 'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.2 Safari/605.1.15', 'referer' => 'https://app.test/orders/form', 'accept-language' => 'en-US,en;q=0.9']; protected $protocolVersion = '1.1'; protected $stream = class OpenSwoole\Core\Psr\Stream { private $resource = resource(341) of type (stream) } }) vendor/middlewares/payload/src/Payload.php:67
 18. OpenSwoole\Core\Psr\Message->getHeaderLine($name = 'Content-Type') vendor/middlewares/payload/src/Payload.php:96
 19. implode($glue = ',', $pieces = 'application/json') vendor/openswoole/core/src/Psr/Message.php:65

My implementation looks like this:

use OpenSwoole\Http\Server;
use OpenSwoole\Constant;

$server = new Server('0.0.0.0', 8000);

$server->set([
    'enable_coroutine' => false,
    'log_level' => Constant::LOG_WARNING,
]);

/** @var Psr\Http\Server\RequestHandlerInterface $handler */
$server->setHandler($handler);

$server->start();

zend_mm_heap corrupted when MYSQL new \PDO called first time

ENV:

RESOLVED
Reason: attribute: \PDO::ATTR_PERSISTENT = TRUE!!!
Please update docs!
Thanks

Swoole version: 22.1.0 and 22.1.2
Maybe it's significant: Runtime::enableCoroutine(true, Runtime::HOOK_TCP);

FROM php:8.3-cli-alpine as builder

RUN apk add --no-cache $PHPIZE_DEPS \
    openssl-dev \
    curl-dev \
    c-ares-dev \
	  linux-headers \
    musl-dev \
	&& docker-php-ext-install sockets curl pdo pdo_mysql \
	&& pecl install -D 'enable-sockets="yes" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="yes" enable-hook-curl="yes" enable-cares="yes" with-postgres="no"' openswoole \
	&& echo 'extension=openswoole.so' > /usr/local/etc/php/conf.d/zz_openswoole.ini 

Code:

       try
        {
            echo 'connectionAttempt...'."\n";
            $this->dbh              = new \PDO($this->dsn, $this->username, $this->password, $this->options);
            echo 'connectionAttempt...2'."\n";
        }
        catch(\PDOException $exception)
        {
            echo 'connectionAttempt: Exception'."\n";

Output:

Request: /heartbeat
connectionAttempt...
zend_mm_heap corrupted
[2023-12-11 20:32:07 $7787.0]   WARNING Server::check_worker_exit_status(): worker(pid=7790, id=0) abnormal exit, status=0, signal=6
Worker 0 started

Default Server Mode

Hey

The Server's constructor stub in https://github.com/openswoole/ide-helper has this:

    public function __construct(string $host, int $port = 0, int $mode = \OpenSwoole\Server::SIMPLE_MODE, int $sockType = \OpenSwoole\Constant::SOCK_TCP)
    {
    }

But the docs here - https://openswoole.com/docs/modules/swoole-server-construct
say:

OpenSwoole\Server::POOL_MODE: Multi process mode, the business logic is running in the child processes, this is the default running mode of a server

Which is correct?

Btw, the description in the docs for SIMPLE_MODE has a typo: "simalar" => "similar" ๐Ÿ‘๐Ÿผ

Thank you!

\OpenSwoole\Server::getLastError() missing in v22.0.0

The \OpenSwoole\Server class no longer appears to have the getLastError() method, that was present in v20x. This method is still listed in the documentation and there is no indication that it has been removed or replaced.

The following script prints the list of available methods, and getLastError() is not shown:

<?php

$co = new \ReflectionClass('\\OpenSwoole\\Server');

foreach ($co->getMethods() as $mo) printf("%s::%s()\n", $mo->class, $mo->name);

For me, this outputs the following list:

OpenSwoole\Server::__construct()
OpenSwoole\Server::__destruct()
OpenSwoole\Server::listen()
OpenSwoole\Server::addlistener()
OpenSwoole\Server::on()
OpenSwoole\Server::handle()
OpenSwoole\Server::setHandler()
OpenSwoole\Server::getCallback()
OpenSwoole\Server::set()
OpenSwoole\Server::start()
OpenSwoole\Server::send()
OpenSwoole\Server::sendto()
OpenSwoole\Server::sendwait()
OpenSwoole\Server::exists()
OpenSwoole\Server::protect()
OpenSwoole\Server::sendfile()
OpenSwoole\Server::close()
OpenSwoole\Server::confirm()
OpenSwoole\Server::pause()
OpenSwoole\Server::resume()
OpenSwoole\Server::task()
OpenSwoole\Server::taskwait()
OpenSwoole\Server::taskWaitMulti()
OpenSwoole\Server::taskCo()
OpenSwoole\Server::finish()
OpenSwoole\Server::reload()
OpenSwoole\Server::shutdown()
OpenSwoole\Server::stop()
OpenSwoole\Server::heartbeat()
OpenSwoole\Server::getClientInfo()
OpenSwoole\Server::getClientList()
OpenSwoole\Server::getWorkerId()
OpenSwoole\Server::getWorkerPid()
OpenSwoole\Server::getWorkerStatus()
OpenSwoole\Server::getManagerPid()
OpenSwoole\Server::getMasterPid()
OpenSwoole\Server::sendMessage()
OpenSwoole\Server::addProcess()
OpenSwoole\Server::stats()
OpenSwoole\Server::getSocket()
OpenSwoole\Server::bind()
OpenSwoole\Timer::after()
OpenSwoole\Timer::tick()
OpenSwoole\Timer::clearTimer()
OpenSwoole\Event::defer()

Run on Ubuntu 22 with PHP 8.2 and Openswoole v22.0.0.

Is 'log_file' only applicable when deamonize = 1?

Hello,

I'm looking for clarification whether log_file is only used when deamonize = 1, please.

As per https://openswoole.com/docs/modules/swoole-server/configuration

If daemonize has been enabled, the standard output and error of the program will be redirected to what the logfile configuration option is set to, if the configuration of log_file hasn't been set, the standard output and error of the program will be redirected to /dev/null.

log_file
Set the log path of Swoole Server.
If you are not using the log file, all error or debug output will be printed to the screen by default. If you are using daemonize => true then this log file will be used to record output. Even if you perform echo, var_dump or print it will be redirected to the log file.

While it's clear that this file is used heavily when deamonize = 1, it's not clear whether it's used for other purposes too, when deamonize = 0.

Thank you very much!

gRPC example issues

I am trying the example with a custom protobuf, seems I have some issues since

Server.php:112 uses class_exists

Fatal error: Uncaught TypeError: TestService not found in /app/vendor/openswoole/grpc/src/Server.php:112
Stack trace:

It seems it cannot find the generated Service since its in its own namespace?

My generated service goes into its namespace based on the proto, and can't seem to be found.

Pretty new to PHP, sorry if this is just a missing configuration or something.

Invalid server options

I followed this example as a template for my server config:
https://openswoole.com/docs/modules/swoole-server/configuration

However, it appears that a number of settings are invalid:

OpenSwoole\Server\Port::set(): Invalid server option: request_slowlog_file
OpenSwoole\Server\Port::set(): Invalid server option: pipe_buffer_size
OpenSwoole\Server\Port::set(): Invalid server option: dns_cache_refresh_time
OpenSwoole\Server\Port::set(): Invalid server option: enable_preemptive_scheduler
OpenSwoole\Server\Port::set(): Invalid server option: open_fastcgi_protocol
OpenSwoole\Server\Port::set(): Invalid server option: enable_object

pecl list | grep swoole

openswoole 22.0.0 stable

Coroutine http client keep alive header

i think keep alive not work i try to enable it but no change in request speed
$client->set(['timeout' => 5, 'http_compression' => true, 'Connection' => 'keep-alive']);
i checked it by
$headers = $client->getHeaders();
$keep_alive = isset($headers['Connection']) && strtolower($headers['Connection']) === 'keep-alive';
and give me false but i enabled it and server i request enabled keep alive

systemd: failed to add systemd socket

Hello!
I want to use systemd. I do everything according to this instruction. My OS is Debian, so files are placed along these paths: /etc/systemd/system/openswoole.socket and /etc/systemd/system/openswoole.service. On run sudo systemctl start openswoole.socket I get an error:

[2024-02-08 22:59:50 @2706.0]   WARNING Server::add_systemd_socket(): invalid LISTEN_PID
PHP Fatal error:  OpenSwoole\Server::__construct(): failed to add systemd socket in /var/www/openswoole/server.php on line 2

Tell me, what could be the reason?

PSR7 getHeader in OpenSwoole\Core\Psr\ServerRequest should return array of string

version: openswoole/core: "22.1.2"

getHeader in OpenSwoole\Core\Psr\ServerRequest should return array of string instead of string

code:

$server->on("request", function (OpenSwoole\Http\Request $request, OpenSwoole\Http\Response $response) {

    $psr_request = \OpenSwoole\Core\Psr\ServerRequest::from($request);
    var_dump($psr_request->getHeader("NotExistsHeader"));
    var_dump($psr_request->getHeader("Accept"));

    $response->header("Content-Type", "text/plain");
    $response->end("Hello World\n");

});

vardump

array(0) {
}
string(135) "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"

$psr_request->getHeader("Accept"); // should return ["text/html","application/xhtml+xml","application/xml;q=0.9","image/avif","image/webp","image/apng","/;q=0.8","application/signed-exchange;v=b3;q=0.7"]

Unable to build with hook-curl support with php 8.2 on Ubuntu 22.04

In file included from /tmp/pear/temp/openswoole/ext-src/swoole_curl.cc:17:
/tmp/pear/temp/openswoole/ext-src/php_swoole_curl.h:25:10: fatal error: curl/curl.h: No such file or directory
   25 | #include <curl/curl.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:248: ext-src/swoole_curl.lo] Error 1

Unable to enable openswoole with option enable-sockets="yes"

got php startup error when install openswoole whith sockets enabled.

Here is my Dockerfile :

FROM php:8.2-cli-bullseye

# args
ARG uid=1001
ARG timezone=Europe/Paris
ARG memory_limit=1G
ARG app_name=openswoole-skeleton
ARG app_env=dev

# install openswoole
RUN apt-get update && \
    apt-get install openssl -y && \
    apt-get install libssl-dev -y && \
    apt-get install libcurl4-openssl-dev -y
RUN docker-php-ext-install sockets
RUN pecl install -D 'enable-sockets="yes" enable-openssl="yes" enable-http2="yes" enable-hook-curl="yes"' openswoole && \
    docker-php-ext-enable openswoole

# install pcov
RUN bash -c "if [ \"$app_env\" == \"dev\" ]; then pecl install pcov; docker-php-ext-enable pcov; echo \"pcov enabled\"; fi"

# install gd
RUN apt-get update && apt-get install -y zlib1g-dev libpng-dev libzip-dev libfreetype-dev fonts-arkpandora
RUN docker-php-ext-configure gd --with-freetype
RUN docker-php-ext-install gd

# install zip
RUN docker-php-ext-install zip

# Php ini
RUN echo "memory_limit = $memory_limit" >> /usr/local/etc/php/conf.d/docker-php-ram-limit.ini
RUN echo 'display_errors=E_ALL & ~E_DEPRECATED' >> /usr/local/etc/php/conf.d/docker-php-error-reporting.ini

# Install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php composer-setup.php --install-dir=/usr/bin --filename=composer

# Set timezone
RUN cp /usr/share/zoneinfo/$timezone /etc/localtime \
    && echo "$timezone" > /etc/timezone \
    && echo "[Date]\ndate.timezone=$timezone" > /usr/local/etc/php/conf.d/timezone.ini

# Install packages
RUN apt-get update && apt-get install -y curl sudo wget git vim zip unzip procps && rm -rf /var/lib/apt/lists/*

# supervisor
RUN apt-get update && apt-get install -y supervisor

# Setup app
COPY ./src /usr/src/$app_name
RUN usermod -u $uid www-data
RUN chown www-data:www-data /var/www
RUN chown -R www-data:www-data /usr/src/$app_name
WORKDIR /usr/src/$app_name

# healthcheck
COPY ./docker/healthcheck /opt/healthcheck
RUN chown 755 /opt/healthcheck
HEALTHCHECK --interval=5s --timeout=3s CMD bash /opt/healthcheck

ENTRYPOINT sleep infinity

Here is composer error :

Warning: PHP Startup: Unable to load dynamic library 'openswoole' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/openswoole.so: undefined symbol: socket_ce)) in Unknown on line 0
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires openswoole/core >=22.1.5 -> satisfiable by openswoole/core[22.1.5].
    - openswoole/core 22.1.5 requires ext-openswoole >=22.0 -> it is missing from your system. Install or enable PHP's openswoole extension.

To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/etc/php/conf.d/docker-php-error-reporting.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-gd.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-openswoole.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-pcov.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sockets.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
    - /usr/local/etc/php/conf.d/docker-php-ext-zip.ini
    - /usr/local/etc/php/conf.d/docker-php-ram-limit.ini
    - /usr/local/etc/php/conf.d/timezone.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-openswoole` to temporarily ignore these required extensions.

Uncaught Error: Undefined constant OpenSwoole\Constant::SSL

In the documentation: https://openswoole.com/docs/modules/swoole-server-construct

To enable SSL: $sock_type | OpenSwoole\Constant::SSL. Check configuration for SSL

So I have:

$server = new Server('*', 9000, \OpenSwoole\Server::POOL_MODE, \OpenSwoole\Constant::SOCK_TCP | \OpenSwoole\Constant::SSL);

However, I get this error:

Uncaught Error: Undefined constant OpenSwoole\Constant::SSL

OpenSwoole v22

I installed openswoole with pecl install openswoole

Unable to get client SSL certificate

According to the documentation for \Swoole\Server::getClientInfo(), the return array will contain the client's SSL certificate in the ssl_client_cert key, when getClientInfo() is called within the onConnect callback.

However, when I run this script (on Ubuntu 22, with PHP 8.1.2 and Swoole 22.0.0), the ssl_client_cert key is not populated when I connect to the server using openssl s_client:

<?php

$server = new \Swoole\Server('127.0.0.1', 12345, SWOOLE_PROCESS, SWOOLE_SOCK_TCP | SWOOLE_SSL);

$server->set([
    'event_object'          => true,

    'ssl_protocols'         => SWOOLE_SSL_TLSv1_3 | SWOOLE_SSL_TLSv1_2,
    'ssl_cert_file'         => '/path/to/server.key',
    'ssl_key_file'          => '/path/to/server.crt',

    'ssl_verify_peer'       => true,
    'ssl_allow_self_signed' => false,
    'ssl_client_cert_file'  => '/path/to/server/ca-certificates.crt',
]);

$server->on('Connect', function($s, $e) {
    $s->send($e->fd, var_export($s->getClientInfo($e->fd), true));
    $s->close($e->fd);
});

$server->on('Receive', function() {});

$server->start();

This script will start a server on port 12345, and when a client with a valid certificate connections, it will send getClientInfo() back to the client and close the connection:

$ openssl s_client -connect 127.0.0.1:12345 -key client.key -cert client.crt
[openssl debug stuff]
array (
  'worker_id' => 3,
  'server_port' => 12345,
  'server_fd' => 4,
  'socket_fd' => 19,
  'socket_type' => 1,
  'remote_port' => 58592,
  'remote_ip' => '127.0.0.1',
  'reactor_id' => 3,
  'connect_time' => 1674215328,
  'last_time' => 1674215328,
  'last_recv_time' => 1674215328.227574,
  'last_send_time' => 0.0,
  'last_dispatch_time' => 0.0,
  'close_errno' => 0,
  'recv_queued_bytes' => 0,
  'send_queued_bytes' => 0,
)read:errno=0

As you can see, the ssl_client_cert is not present.

`Call to undefined method PDO::close()` when closing connection pool

Any attempt to call $pool->close() on a ClientPool with PDO connections ends with:

Error: Uncaught Error: Call to undefined method PDO::close() in ./vendor/openswoole/core/src/Coroutine/Client/PDOClient.php:46  
  Stack trace:                                                                                                                                                   
  #0 ./vendor/openswoole/core/src/Coroutine/Pool/ClientPool.php(89): OpenSwoole\Core\Coroutine\Client\PDOClient->__call()         
  #1 ./src/WebSocket/PoolRunner/AbstractRunner.php(19): OpenSwoole\Core\Coroutine\Pool\ClientPool->close() 

Client pool attempts to close remaining collections by calling non-existent close method on underlying objects.

Uncaught Error: Undefined constant OpenSwoole\Constant::SSL_TLSv1_2

I installed openswoole:

pecl install openswoole

While most/all constants seem to exist and work, these ones in specific seem to fail:

'ssl_protocols' => \OpenSwoole\Constant::SSL_TLSv1_2 | \OpenSwoole\Constant::SSL_TLSv1_3,

It causes:

PHP Fatal error: Uncaught Error: Undefined constant OpenSwoole\Constant::SSL_TLSv1_2

They seem to be correct as per the documentation:
https://openswoole.com/docs/swoole-predefined-constants

OpenSwoole v22

How can I enable ssl for gRPC client

In examples I see this: $client = new \OpenSwoole\GRPC\Client($domain, 443);, but ssl not enabled.
For activate ssl in docs, I see this: $client = new OpenSwoole\Coroutine\Http2\Client($domain, 443, true);,
but in code Client.php: $client = new Coroutine\Http2\Client($host, $port); without bool ssl

How can I enable ssl for gRPC client?
Maybe I must set options?

P.S. I try set option "ssl_host_name", not work

openswoole 22.1 pecl build fails in alpine based docker containers

Currently trying to get images ready for php8.3

however i cannot get openswoole to build via pecl in alpine based image

debian.Dockerfile (works)

FROM php:8.3.0

RUN apt update  \
 && apt install -y libssl-dev libcurl4-openssl-dev \
 && pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="no" enable-hook-curl="yes" enable-cares="yes" with-postgres="no"' openswoole-22.1.0 \
 && docker-php-ext-enable openswoole

ENTRYPOINT php -m | grep openswoole

alpine.Dockerfile (fails, see log)

FROM php:8.3.0-alpine3.18

RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
 && apk add openssl-dev \
 && pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="no" enable-hook-curl="yes" enable-cares="yes" with-postgres="no"' openswoole-22.1.0 \
 && apk del .build-deps

RUN php -m

Build Log:

[+] Building 12.9s (5/6)                                                                                                                                                                                                                                                                                                                             docker:default
 => [internal] load build definition from 8.3-alpine-swoole.Dockerfile                                                                                                                                                                                                                                                                                         0.0s
 => => transferring dockerfile: 388B                                                                                                                                                                                                                                                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                0.0s
 => [internal] load metadata for docker.io/library/php:8.3.0-alpine3.18                                                                                                                                                                                                                                                                                        0.0s
 => CACHED [1/3] FROM docker.io/library/php:8.3.0-alpine3.18                                                                                                                                                                                                                                                                                                   0.0s
 => ERROR [2/3] RUN apk add --no-cache --virtual .build-deps autoconf   dpkg-dev dpkg   file   g++   gcc   libc-dev   make   pkgconf   re2c  && apk add openssl-dev  && pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="no" enable-hook-curl="yes" enable-cares="yes" with-postgres="no"' openswoole-22.1.0  &&  12.9s
------                                                                                                                                                                                                                                                                                                                                                              
 > [2/3] RUN apk add --no-cache --virtual .build-deps autoconf          dpkg-dev dpkg           file            g++             gcc             libc-dev                make            pkgconf                 re2c  && apk add openssl-dev  && pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="no" enable-hook-curl="yes" enable-cares="yes" with-postgres="no"' openswoole-22.1.0  && apk del .build-deps:                                                                                                                                                                                                                                                                              
0.173 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz                                                                                                                                                                                                                                                                                 
0.446 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz                                                                                                                                                                                                                                                                            
0.607 (1/27) Installing m4 (1.4.19-r3)                                                                                                                                                                                                                                                                                                                              
0.648 (2/27) Installing libbz2 (1.0.8-r5)
0.677 (3/27) Installing perl (5.36.2-r0)
0.879 (4/27) Installing autoconf (2.71-r2)
0.918 (5/27) Installing pkgconf (1.9.5-r0)
0.948 (6/27) Installing dpkg-dev (1.21.21-r1)
0.992 (7/27) Installing libmd (1.0.4-r2)
1.019 (8/27) Installing dpkg (1.21.21-r1)
1.057 (9/27) Installing libmagic (5.45-r0)
1.103 (10/27) Installing file (5.45-r0)
1.130 (11/27) Installing libstdc++ (12.2.1_git20220924-r10)
1.179 (12/27) Installing libstdc++-dev (12.2.1_git20220924-r10)
1.387 (13/27) Installing zstd-libs (1.5.5-r4)
1.423 (14/27) Installing binutils (2.40-r7)
1.482 (15/27) Installing libgomp (12.2.1_git20220924-r10)
1.516 (16/27) Installing libatomic (12.2.1_git20220924-r10)
1.548 (17/27) Installing gmp (6.2.1-r3)
1.579 (18/27) Installing isl26 (0.26-r1)
1.628 (19/27) Installing mpfr4 (4.2.0_p12-r0)
1.662 (20/27) Installing mpc1 (1.3.1-r1)
1.690 (21/27) Installing gcc (12.2.1_git20220924-r10)
2.184 (22/27) Installing musl-dev (1.2.4-r2)
2.248 (23/27) Installing libc-dev (0.7.2-r5)
2.274 (24/27) Installing g++ (12.2.1_git20220924-r10)
2.448 (25/27) Installing make (4.4.1-r1)
2.474 (26/27) Installing re2c (3.0-r1)
2.509 (27/27) Installing .build-deps (20231204.103422)
2.510 Executing busybox-1.36.1-r5.trigger
2.514 OK: 298 MiB in 64 packages
2.558 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
2.823 fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
3.033 (1/1) Installing openssl-dev (3.1.4-r1)
3.076 OK: 301 MiB in 65 packages
5.585 downloading openswoole-22.1.0.tgz ...
5.585 Starting to download openswoole-22.1.0.tgz (1,252,350 bytes)
5.585 ........................................................................................................................................................................................................................................................done: 1,252,350 bytes
6.506 485 source files, building
6.507 running: phpize
6.510 Configuring for:
6.510 PHP Api Version:         20230831
6.510 Zend Module Api No:      20230831
6.510 Zend Extension Api No:   420230831
6.844 config.m4:327: warning: The macro `AC_PROG_CC_C99' is obsolete.
6.844 config.m4:327: You should run autoupdate.
6.844 ./lib/autoconf/c.m4:1659: AC_PROG_CC_C99 is expanded from...
6.844 config.m4:327: the top level
7.344 building in /tmp/pear/temp/pear-build-defaultuserBBAjlH/openswoole-22.1.0
7.344 running: /tmp/pear/temp/openswoole/configure --with-php-config=/usr/local/bin/php-config --enable-sockets=no --enable-openssl=yes --enable-http2=yes --enable-mysqlnd=no --enable-hook-curl=yes --with-postgres=no
7.396 checking for grep that handles long lines and -e... /bin/grep
7.396 checking for egrep... /bin/grep -E
7.397 checking for a sed that does not truncate output... /bin/sed
7.403 checking for pkg-config... /usr/bin/pkg-config
7.403 checking pkg-config is at least version 0.9.0... yes
7.403 checking for cc... cc
7.431 checking whether the C compiler works... yes
7.431 checking for C compiler default output file name... a.out
7.449 checking for suffix of executables...
7.469 checking whether we are cross compiling... no
7.482 checking for suffix of object files... o
7.493 checking whether the compiler supports GNU C... yes
7.506 checking whether cc accepts -g... yes
7.545 checking for cc option to enable C11 features... none needed
7.558 checking how to run the C preprocessor... cc -E
7.578 checking for icc... no
7.584 checking for suncc... no
7.584 checking for system library directory... lib
7.603 checking if compiler supports -Wl,-rpath,... yes
7.628 checking build system type... x86_64-pc-linux-musl
7.628 checking host system type... x86_64-pc-linux-musl
7.628 checking target system type... x86_64-pc-linux-musl
7.657 checking for PHP prefix... /usr/local
7.657 checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib
7.657 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20230831
7.658 checking for PHP installed headers prefix... /usr/local/include/php
7.666 checking if debug is enabled... no
7.674 checking if zts is enabled... no
7.674 checking for gawk... no
7.674 checking for nawk... no
7.674 checking for awk... awk
7.675 checking if awk is broken... no
7.675 checking enable debug log... no
7.675 checking enable trace log... no
7.675 checking enable sockets support... no
7.675 checking enable openssl support... yes
7.675 checking enable HTTP2 support... yes
7.675 checking openswoole support... yes, shared
7.675 checking enable mysqlnd support... no
7.675 checking enable PostgreSQL support... no
7.675 checking enable c-ares support... no
7.675 checking dir of openssl... no
7.675 checking dir of jemalloc... no
7.675 checking enable asan... no
7.675 checking whether to enable coverage testing... no
7.675 checking whether to enable developer build flags... no
7.675 checking whether to enable Coroutine Hooks for CURL build flags... yes
7.675 checking whether to enable thread context... no
7.683 checking if compiling with clang... no
7.707 checking for accept4 in -lc... yes
7.727 checking for signalfd in -lc... yes
7.747 checking for eventfd in -lc... yes
7.768 checking for epoll_create in -lc... yes
7.789 checking for poll in -lc... yes
7.808 checking for sendfile in -lc... yes
7.831 checking for kqueue in -lc... no
7.855 checking for backtrace in -lc... no
7.874 checking for daemon in -lc... yes
7.894 checking for mkostemp in -lc... yes
7.914 checking for inotify_init in -lc... yes
7.938 checking for malloc_trim in -lc... no
7.959 checking for inotify_init1 in -lc... yes
7.981 checking for ptrace in -lc... yes
8.000 checking for getrandom in -lc... yes
8.022 checking for arc4random in -lc... no
8.042 checking for pthread_rwlock_init in -lpthread... yes
8.063 checking for pthread_spin_lock in -lpthread... yes
8.083 checking for pthread_mutex_timedlock in -lpthread... yes
8.207 checking for pthread_barrier_init in -lpthread... yes
8.227 checking for pthread_mutexattr_setpshared in -lpthread... yes
8.249 checking for pthread_mutexattr_setrobust in -lpthread... yes
8.270 checking for pthread_mutex_consistent in -lpthread... yes
8.290 checking for pcre_compile in -lpcre... no
8.310 checking for ares_gethostbyname in -lcares... no
8.329 checking for gzgets in -lz... no
8.347 checking for BrotliEncoderCreateInstance in -lbrotlienc... no
8.355 checking for cpu affinity... no
8.371 checking for socket REUSEPORT... yes
8.379 checking for futex... no
8.397 checking for ucontext... yes
8.397 checking for g++... g++
8.418 checking whether the compiler supports GNU C++... yes
8.431 checking whether g++ accepts -g... yes
8.484 checking for g++ option to enable C++11 features... none needed
8.492 checking for valgrind... no
8.502 checking for stdio.h... yes
8.516 checking for stdlib.h... yes
8.530 checking for string.h... yes
8.545 checking for inttypes.h... yes
8.560 checking for stdint.h... yes
8.574 checking for strings.h... yes
8.589 checking for sys/stat.h... yes
8.606 checking for sys/types.h... yes
8.624 checking for unistd.h... yes
8.640 checking for struct cmsghdr... yes
8.663 checking for hstrerror... yes
8.686 checking for socketpair... yes
8.708 checking for if_nametoindex... yes
8.732 checking for if_indextoname... yes
8.752 checking for netdb.h... yes
8.771 checking for netinet/tcp.h... yes
8.788 checking for sys/un.h... yes
8.801 checking for sys/sockio.h... no
8.821 checking for field ss_family in struct sockaddr_storage... yes
8.836 checking if getaddrinfo supports AI_V4MAPPED... yes
8.852 checking if getaddrinfo supports AI_ALL... yes
8.864 checking if getaddrinfo supports AI_IDN... no
8.883 checking if gethostbyname2_r is supported... yes
8.891 checking for valgrind... no
8.912 checking for clock_gettime in -lrt... yes
8.946 checking openssl fallback dir... checking for SSL_connect in -lssl... yes
8.991 checking openswoole coverage... enabled
9.004 checking whether the compiler supports GNU C++... (cached) yes
9.004 checking whether g++ accepts -g... (cached) yes
9.004 checking for g++ option to enable C++11 features... (cached) none needed
9.040 checking how to run the C++ preprocessor... g++ -E
9.057 checking for a sed that does not truncate output... /bin/sed
9.061 checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
9.063 checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
9.063 checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
9.064 checking for BSD-compatible nm... /usr/bin/nm -B
9.064 checking whether ln -s works... yes
9.064 checking how to recognize dependent libraries... pass_all
9.090 checking for dlfcn.h... yes
9.090 checking how to run the C++ preprocessor... g++ -E
9.105 checking the maximum length of command line arguments... 98304
9.142 checking command to parse /usr/bin/nm -B output from cc object... ok
9.143 checking for objdir... .libs
9.144 checking for ar... ar
9.144 checking for ranlib... ranlib
9.144 checking for strip... strip
9.186 checking if cc supports -fno-rtti -fno-exceptions... no
9.186 checking for cc option to produce PIC... -fPIC
9.196 checking if cc PIC flag -fPIC works... yes
9.215 checking if cc static flag -static works... yes
9.228 checking if cc supports -c -o file.o... yes
9.236 checking whether the cc linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
9.250 checking whether -lc should be explicitly linked in... no
9.254 checking dynamic linker characteristics... GNU/Linux ld.so
9.254 checking how to hardcode library paths into programs... immediate
9.255 checking whether stripping libraries is possible... yes
9.255 checking if libtool supports shared libraries... yes
9.255 checking whether to build shared libraries... yes
9.256 checking whether to build static libraries... no
9.290 
9.290 creating libtool
9.316 appending configuration tag "CXX" to libtool
9.369 checking for ld used by g++... /usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64
9.370 checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) is GNU ld... yes
9.374 checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
9.394 checking for g++ option to produce PIC... -fPIC
9.404 checking if g++ PIC flag -fPIC works... yes
9.425 checking if g++ static flag -static works... yes
9.438 checking if g++ supports -c -o file.o... yes
9.438 checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
9.438 checking dynamic linker characteristics... GNU/Linux ld.so
9.438 (cached) (cached) checking how to hardcode library paths into programs... immediate
9.531 configure: patching config.h.in
9.532 configure: creating ./config.status
9.551 config.status: creating config.h
9.574 running: make
9.605 /bin/sh /tmp/pear/temp/pear-build-defaultuserBBAjlH/openswoole-22.1.0/libtool --mode=compile g++ -I. -I/tmp/pear/temp/openswoole -I/tmp/pear/temp/pear-build-defaultuserBBAjlH/openswoole-22.1.0/include -I/tmp/pear/temp/pear-build-defaultuserBBAjlH/openswoole-22.1.0/main -I/tmp/pear/temp/openswoole -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/openswoole -I/tmp/pear/temp/openswoole/include -I/tmp/pear/temp/openswoole/ext-src -I/tmp/pear/temp/openswoole/thirdparty/hiredis  -DHAVE_CONFIG_H  -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11    -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/openswoole/ext-src/php_swoole.cc -o ext-src/php_swoole.lo  -MMD -MF ext-src/php_swoole.dep -MT ext-src/php_swoole.lo
9.650 mkdir ext-src/.libs
9.650  g++ -I. -I/tmp/pear/temp/openswoole -I/tmp/pear/temp/pear-build-defaultuserBBAjlH/openswoole-22.1.0/include -I/tmp/pear/temp/pear-build-defaultuserBBAjlH/openswoole-22.1.0/main -I/tmp/pear/temp/openswoole -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/openswoole -I/tmp/pear/temp/openswoole/include -I/tmp/pear/temp/openswoole/ext-src -I/tmp/pear/temp/openswoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -std=c++11 -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/openswoole/ext-src/php_swoole.cc -MMD -MF ext-src/php_swoole.dep -MT ext-src/php_swoole.lo  -fPIC -DPIC -o ext-src/.libs/php_swoole.o
10.09 In file included from /usr/include/c++/12.2.1/clocale:42,
10.09                  from /usr/include/c++/12.2.1/x86_64-alpine-linux-musl/bits/c++locale.h:41,
10.09                  from /usr/include/c++/12.2.1/bits/localefwd.h:40,
10.09                  from /usr/include/c++/12.2.1/string:43,
10.09                  from /tmp/pear/temp/openswoole/include/swoole_log.h:21,
10.09                  from /tmp/pear/temp/openswoole/include/swoole.h:129,
10.09                  from /tmp/pear/temp/openswoole/include/swoole_api.h:21,
10.09                  from /tmp/pear/temp/openswoole/ext-src/php_swoole_private.h:29,
10.09                  from /tmp/pear/temp/openswoole/ext-src/php_swoole_cxx.h:19,
10.09                  from /tmp/pear/temp/openswoole/ext-src/php_swoole.cc:16:
10.09 /tmp/pear/temp/openswoole/ext-src/php_swoole_private.h: In function 'char* php_swoole_http_build_query(zval*, size_t*, smart_str*)':
10.09 /tmp/pear/temp/openswoole/ext-src/php_swoole_private.h:1050:63: error: cannot convert 'std::nullptr_t' to 'size_t' {aka 'long unsigned int'}
10.09  1050 |         php_url_encode_hash_ex(HASH_OF(zdata), formstr, NULL, NULL, NULL, NULL, NULL, (int) PHP_QUERY_RFC1738);
10.09       |                                                               ^~~~
10.09       |                                                               |
10.09       |                                                               std::nullptr_t
10.09 In file included from /tmp/pear/temp/openswoole/ext-src/php_swoole_private.h:43:
10.09 /usr/local/include/php/ext/standard/php_http.h:25:64: note:   initializing argument 4 of 'void php_url_encode_hash_ex(HashTable*, smart_str*, const char*, size_t, const zend_string*, zval*, const zend_string*, int)'
10.09    25 |                                 const char *num_prefix, size_t num_prefix_len,
10.09       |                                                         ~~~~~~~^~~~~~~~~~~~~~
10.51 make: *** [Makefile:221: ext-src/php_swoole.lo] Error 1
10.53 ERROR: `make' failed
------
8.3-alpine-swoole.Dockerfile:3
--------------------
   2 |     
   3 | >>> RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
   4 | >>>  && apk add openssl-dev \
   5 | >>>  && pecl install -D 'enable-sockets="no" enable-openssl="yes" enable-http2="yes" enable-mysqlnd="no" enable-hook-curl="yes" enable-cares="yes" with-postgres="no"' openswoole-22.1.0 \
   6 | >>>  && apk del .build-deps
   7 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c apk add --no-cache --virtual .build-deps $PHPIZE_DEPS  && apk add openssl-dev  && pecl install -D 'enable-sockets=\"no\" enable-openssl=\"yes\" enable-http2=\"yes\" enable-mysqlnd=\"no\" enable-hook-curl=\"yes\" enable-cares=\"yes\" with-postgres=\"no\"' openswoole-22.1.0  && apk del .build-deps" did not complete successfully: exit code: 1

Missing Swoole\ConnectionPool in ide helper

Hi,

it looks like connection pool (Swoole\ConnectionPool) is missing in version 22.0.0.
I can find connection pool implementation in openswoole - https://github.com/openswoole/library/blob/master/src/core/ConnectionPool.php but can not find in openswoole ide helper - https://github.com/openswoole/ide-helper.

Also in changelog does not seem to be deprecated or removed - https://openswoole.com/article/v22-0-0-released .

Is there any replacement or why is missing in ide helper?

Error in PDOStatementProxy

It looks like PDOStatement::errorInfo may return null values. Trace:

    {
        "file": "/app/vendor/openswoole/core/src/Coroutine/Client/PDOStatementProxy.php",
        "line": 67,
        "function": "__construct",
        "class": "Exception",
        "type": "->",
        "args": [
            null,
            null
        ]
    },
    {
        "file": "/app/src/Database/Traits/PDOStatementAdapterTrait.php",
        "line": 77,
        "function": "__call",
        "class": "OpenSwoole\\Core\\Coroutine\\Client\\PDOStatementProxy",
        "type": "->",
        "args": [
            "execute",
            [
                {
                    "clientid": "*****",
                    "id": "*****",
                    "phone": "*****"
                }
            ]
        ]
    },

I have edited the code adding a var_dump of $this->__object and $errorInfo:

object(PDOStatement)#133 (1) {
  ["queryString"]=>
  string(140) "SELECT /* ContactRepository:existsPhone */ `id` FROM `contacts` WHERE `clientid` = :clientid AND `phone` = :phone ORDER BY `id` DESC LIMIT 1"
}
array(3) {
  [0]=>
  string(5) "HY093"
  [1]=>
  NULL
  [2]=>
  NULL
}

The problem is that im passing id parameter to execute for a query that does not have :id. The return value of PDOStatement::errorInfo is ['HY093', null, null] and then fails throwing the PDOException at

$exception = new PDOException($errorInfo[2], $errorInfo[1]);

I suggest checking if $errorInfo[1] is_int and $errorInfo[2] is_string and, if not, throw a PDOException with a "generic message". What do you think? May I send a PR fixing it?

Co\http\Client::upgrade("/") block coroutine by calling from Process

Co\http\Client::upgrade("/") freeze and block execution in some case.

This works well in the call structure: co::run -> go() -> go()

But it block when I wrap it in a call structure: OpenSwoole\HTTP\Server -> addProcess -> go()

Also this is well in structure: OpenSwoole\HTTP\Server -> on("request")-> go()

Two Swoole (HTTP and TCP) servers in same php file not working

Hi,

Having two servers working well when launched independantly but when included/called together in one same php file, only the first one (TCP) is working.

When i invert the two requires, it still works but this time the first (HTTP) is working.

Can't figure out what's happening.

Websocket.zip

Would appreciate any help

Cassandra\Exception\InvalidArgumentException: options must be an instance of Cassandra\ExecutionOptions or an array or null

For this code:

$result = $this->session->execute($query, null);

I'm getting the following error:

Cassandra\Exception\InvalidArgumentException: options must be an instance of Cassandra\ExecutionOptions or an array or null

It shouldn't say "or null", if NULL isn't accepted :)

Also, in relation to an instance of Cassandra\ExecutionOptions, it appears to be deprecated, as per https://github.com/openswoole/ide-helper

image

HTTP Server - on('Finish') not called when task() is called outside of handle()

I have trouble understanding how to use the task() method to trigger task workers. When calling $server->task() inside the handle method, the on('Finish') callback will be called, but not outside of it. In the example below, I am trying to use a Timer to trigger a task every 3 seconds. According to https://openswoole.com/docs/modules/swoole-server-task, using task should not be possible in a user process and sendMessage should be used? How should this be approached correctly?

<?php

declare(strict_types=1);

require_once __DIR__ . '/../vendor/autoload.php';

use OpenSwoole\Constant;
use OpenSwoole\HTTP\Server;
use OpenSwoole\Runtime;
use OpenSwoole\Core\Psr\Response;
use OpenSwoole\Timer;
use Psr\Http\Message\ServerRequestInterface;

OpenSwoole\Runtime::enableCoroutine(enable: true, flags: Runtime::HOOK_ALL);

$server = new Server('0.0.0.0', 9501, Server::POOL_MODE);
$server->set([
    'log_level' => Constant::LOG_ERROR,
    'worker_num' => OpenSwoole\Util::getCPUNum(),
    'task_worker_num' => OpenSwoole\Util::getCPUNum() * 4,
]);

$server->handle(function (ServerRequestInterface $request) {
    // does trigger onFinish callback
    $server->task(['type' => 'triggers_callback']);

    return new Response('1', 200);
});

$server->on('Task', function (Server $server, $task_id, $reactorId, $data) {
    echo "Task#$taskId started, data_len=", $data;
});

$server->on('Finish', function ($server, $taskId, $data) {
    echo "Task#$taskId finished, data_len=", $data;
});

$server->on('Start', function () use ($server) {
    Timer::tick(3000, function () use ($server) {

        // does not trigger onFinish callback
        $server->task(['type' => 'no_callback']);
    });
});

$server->start();

Difference between PDOClient and PostgreSQL

Hi there ๐Ÿ‘‹

We are using openswoole in our project, it is a simple HTTP server connecting to a Postgres database using a Coroutine ClientPool.

We are currently using the OpenSwoole\Core\Coroutine\Client\PDOClient to connect to our Postgres database, and it is functional, however I was wondering what was the difference between this solution and the dedicated OpenSwoole\Coroutine\PostgreSQL?

Should we consider switching to PostgreSQL?
If yes, why?

Thanks

Unable to compile

trying to compile it since i cannot do

pecl install openswoole-22.0.0
No releases available for package "pecl.php.net/openswoole"
install failed

I've downloaded tarball from https://pecl.php.net/package/openswoole and i've tried the installing from source describe on this page. https://openswoole.com/docs/get-started/installation

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye

when installing im getting this error, im unsure how to proceed, its php 8.2, self compiled
PHP 8.2.6 (cli) (built: May 31 2023 14:41:21) (ZTS)
Copyright (c) The PHP Group
Zend Engine v4.2.6, Copyright (c) Zend Technologies

error.txt

If this is the competely wrong place to post this, im sorry, but would be happy if you could direct me to the right place to do so.

"Try Open Swoole with Docker" tutorial docker build fails: "fatal error: curl/curl.h: No such file or directory"

I copied the Dockerfile and built it as instructed on https://openswoole.com/docs/get-started/try-docker

Upon build, I got the error:

#0 21.41  g++ -I. -I/tmp/ext-openswoole -I/tmp/ext-openswoole/include -I/tmp/ext-openswoole/main -I/tmp/ext-openswoole -I/usr/local/include/php -I/usr/local/include/php/main
 -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/ext-openswoole -I/tmp/ext-openswoole/i
nclude -I/tmp/ext-openswoole/ext-src -I/tmp/ext-openswoole/thirdparty/hiredis -DHAVE_CONFIG_H -g -O2 -Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations 
-std=c++11 -DENABLE_PHP_SWOOLE -DZEND_COMPILE_DL_EXT=1 -c /tmp/ext-openswoole/ext-src/swoole_curl.cc -MMD -MF ext-src/swoole_curl.dep -MT ext-src/swoole_curl.lo  -fPIC -DPIC
 -o ext-src/.libs/swoole_curl.o                                                                                                                                              
#0 21.53 In file included from /tmp/ext-openswoole/ext-src/swoole_curl.cc:17:                                                                                                
#0 21.53 /tmp/ext-openswoole/ext-src/php_swoole_curl.h:25:10: fatal error: curl/curl.h: No such file or directory
#0 21.53    25 | #include <curl/curl.h>                                                                                                                                      
#0 21.53       |          ^~~~~~~~~~~~~                                                                                                                                      
#0 21.53 compilation terminated.                                                                                                                                             
#0 21.53 make: *** [Makefile:248: ext-src/swoole_curl.lo] Error 1                                                                                                            
------                                                                                                                                                                       
Dockerfile:11                                                                                                                                                                
--------------------                                                                                                                                                         
  10 |                                                                                                                                                                       
  11 | >>> RUN cd /tmp && git clone https://github.com/openswoole/ext-openswoole.git && \                                                                                    
  12 | >>>     cd ext-openswoole && \                                                 
  13 | >>>     git checkout v22.0.0 && \                                                                                                                                     
  14 | >>>     phpize  && \                                                                                                                                                  
  15 | >>>     ./configure --enable-openssl --enable-hook-curl --enable-http2 --enable-mysqlnd && \                                                                          
  16 | >>>     make && make install                                                                                                                                          
  17 |                                                                                
--------------------                                                                                                                                                         
ERROR: failed to solve: process "/bin/sh -c cd /tmp && git clone https://github.com/openswoole/ext-openswoole.git &&     cd ext-openswoole &&     git checkout v22.0.0 &&    
 phpize  &&     ./configure --enable-openssl --enable-hook-curl --enable-http2 --enable-mysqlnd &&     make && make install" did not complete successfully: exit code: 2

Response Cookie should send Max-Age

The cookie and rawCookie function in the Response class should also support the HTTP Max-Age parameter for clients with an invalid configured timestamp.

Links in documentation are not legible (accessibility issue)

For example, this paragraph has a link (see https://openswoole.com/docs/get-started-swoole#try-it-with-docker):

image

Similar issue exists in the dark theme, except the color is far too dark and instead starts to blend in with the background color:

image

My apologies if this isn't the right repository. I looked for a repo that contained the docs but it was not easy to find (no edit links in the docs and I didn't notice where the docs were managed, if they're on github). Just happened upon this issue when trying to read through the docs for the first time and found them very difficult to go through due to the issues with links.

http listen on unix socket

Hello,

I'm currently facing an issue with listening to the HTTP server on a Unix socket. I attempted to implement it using the following code snippet:

new Swoole\Http\Server("unix:/tmp/socket.sock") ( I tried without "unix:" too )
However, it doesn't seem to be working as expected. The server isn't listening on the specified Unix socket, and the corresponding file isn't being created. I've searched extensively online and in the documentation but haven't found any relevant information.

This situation is quite perplexing, and I'm having a heated debate with GPT about it. GPT is confident that this functionality should be possible, but I haven't been able to achieve it. My goal is to create a configuration similar to the following:

proxy_pass http://unix:/tmp/socket.sock;

I've successfully used Unix sockets with Node.js Express in the past, and I'm eager to replicate the same with Swoole. Could you please provide guidance on whether this is achievable with Swoole? Any assistance would be greatly appreciated.

`Fatal error: Uncaught Error: Class "OpenSwoole\Core\Psr\Middleware\StackHandler" not found` when trying to use psr-7 server with openswoole 22

I'm experimenting on updating an app to openswoole 22, by using its psr-7 support.

I have set-up a very simple start script, called openswoole-worker.php, which is basically the same example in the docs:

<?php

declare(strict_types=1);

use OpenSwoole\Core\Psr\Middleware\StackHandler;
use OpenSwoole\Core\Psr\Response;
use OpenSwoole\HTTP\Server;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

require __DIR__ . '/../vendor/autoload.php';

$server = new Server('0.0.0.0', 8080);
$server->on('start', function (Server $server) {
    echo "OpenSwoole http server is started at http://0.0.0.0:8080
";
});

$stack = (new StackHandler())
    ->add(new class implements MiddlewareInterface
    {
        public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
        {
            return (new Response('aaaa'))->withHeader('x-a', '1234');
        }
    });

$server->setHandler($stack);

$server->start();

When I try to run it via php openswoole-worker.php, it throws the next error:

Fatal error: Uncaught Error: Class "OpenSwoole\Core\Psr\Middleware\StackHandler" not found in /home/app/openswoole-worker.php:21
Stack trace:
#0 {main}
  thrown in /home/app/openswoole-worker.php on line 21

I have also tried using my own handler, instead of the StackHandler, but then it fails to find another class:

Invalid callback \OpenSwoole\Core\Helper::setHandler, class "\OpenSwoole\Core\Helper" not found.

I have also noticed that I don't get a proper autocompletion for neither of those classes even when my project depends on "openswoole/ide-helper": "~22.0.1", but since those are basically stubs, I thought the definition would just not be up to date yet.

Is there anything that needs tobe done for openswoole 22 to support PSR-7?

Hot reload SSL certificates

My SSL certificates are renewed every 2 months, using Certbot/LetsEncrypt.

Is there a way I can hot reload the SSL certificates on OpenSwoole, so they don't eventually expire while the app is live?

Ideally, in a graceful way, without any downtime.

add native support for windows

please add native support for Windows, the PHP language has been cross-platform practically forever, and most php developers are working on windows machines

Title: Handling Encrypted Packet Splitting in PHP Swoole

I am currently developing a TCP server using PHP Swoole and implementing a backend based on the MTProto protocol. In this setup, clients send an initial packet structured as {[Key, IV] + [Data Length] + [Data]}, where both the data length and data are encrypted.

Upon receiving this, the server utilizes the provided key and IV to decrypt the data length, enabling it to understand and segregate the incoming data accordingly. Moreover, the server is designed to generate an AES-CTR encryption key from this initial packet, which is then employed to decrypt subsequent packets.

However, I'm facing challenges with the nature of encrypted packet length as the server requires the decryption key in advance to determine the split points for incoming packets. This scenario is managed in Swoole by setting open_length_check to false and customizing the package_length_func for packet splitting. My main issue arises with retaining and utilizing the initial decryption key for processing future packets, as I haven't found a way to efficiently store this key post its initial receipt.

I seek advice or solutions on the following:

Strategies for effectively saving and reusing the decryption key obtained from the first packet.
Best practices for managing the decryption and splitting of encrypted packets in a PHP Swoole environment, especially under the constraints of the MTProto protocol.

IDE Helper: Expected parameter types are OpenSwoole\string, OpenSwoole\int, etc.

On a bunch of things, for example the constructor of OpenSwoole\HTTP\Server I'm getting this strange warning: Expected parameter of type 'OpenSwoole\string', 'string' provided
image

I don't know what's causing these and can't seem to get rid of them, does anybody know what's going on?
I also tried the non-open swoole IDE helper and it didn't have this problem.

Warning when trying to subscribe a server to a multicast group

Hello,

I am trying to bind a server to a multicast group, unfortunately, I get this warning :

PHP Warning: socket_set_option(): Unable to set socket option [92]: Protocol not available

I am using the copy/paste code from this documentation page :

https://openswoole.com/docs/modules/swoole-server-getSocket

namely, this line :

$ret = socket_set_option( $socket, IPPROTO_IP, MCAST_JOIN_GROUP, [ 'group' => '10.0.0.1', 'interface' => 'eth0' ] );
(assuming 10.0.0.1 is a muticast address)
I also tried using number '2' instead of IPPROTO_IP, unsuccessfully.

My environment is :
Windows 10
WSL 1
Ubuntu 22.04 LTS

BTW what about the port assignment, especially if you want a client to subscribe to the same group ?
Indeed a client would connect this way I guess :
$client->connect('10.0.0.1', 9905, 0.5)

So what about the port ? Do we care about it ?

Thanks for your help.

Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.