From faa15c1f5e20a6cae59191826781dd72e1b12552 Mon Sep 17 00:00:00 2001 From: Slavey Karadzhov Date: Mon, 5 Feb 2024 14:46:31 +0100 Subject: [PATCH 1/3] Prepare for working with newer versions of OpenSwoole. Signed-off-by: Slavey Karadzhov --- compat/openswoole.php | 14 ++++++++++++++ composer.json | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 compat/openswoole.php diff --git a/compat/openswoole.php b/compat/openswoole.php new file mode 100644 index 0000000..c2eb030 --- /dev/null +++ b/compat/openswoole.php @@ -0,0 +1,14 @@ +=')) { + function swoole_set_process_name(string $process_name): void + { + Util::setProcessName($process_name); + } +} diff --git a/composer.json b/composer.json index d969ee4..e5d4277 100644 --- a/composer.json +++ b/composer.json @@ -67,7 +67,10 @@ "autoload": { "psr-4": { "Mezzio\\Swoole\\": "src/" - } + }, + "files": [ + "compat/openswoole.php" + ] }, "autoload-dev": { "psr-4": { From 01a247d9f15071fe44396280448308652a12cfbc Mon Sep 17 00:00:00 2001 From: Slavey Karadzhov Date: Mon, 5 Feb 2024 16:31:26 +0100 Subject: [PATCH 2/3] Make sure not to fail when the openswoole module is not installed. Signed-off-by: Slavey Karadzhov --- compat/openswoole.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/openswoole.php b/compat/openswoole.php index c2eb030..2e4760d 100644 --- a/compat/openswoole.php +++ b/compat/openswoole.php @@ -6,7 +6,7 @@ // @see https://github.com/mezzio/mezzio-swoole/issues/110#issuecomment-1500174967 // Override the swoole_set_process_name function -if (version_compare(phpversion('openswoole'), '22.0.0', '>=')) { +if (version_compare((string)phpversion('openswoole'), '22.0.0', '>=')) { function swoole_set_process_name(string $process_name): void { Util::setProcessName($process_name); From 9231655edcb4c5a9f6d94a6bd04b11edde107502 Mon Sep 17 00:00:00 2001 From: Slavey Karadzhov Date: Mon, 5 Feb 2024 17:23:41 +0100 Subject: [PATCH 3/3] Help the migration to openswoole v22 and later. Signed-off-by: Slavey Karadzhov --- docs/book/v4/migration.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/book/v4/migration.md b/docs/book/v4/migration.md index e25cebb..6b83d54 100644 --- a/docs/book/v4/migration.md +++ b/docs/book/v4/migration.md @@ -43,3 +43,10 @@ return [ ``` If you are using Mezzio 3.11.0 or later, you can also use its `Mezzio\Container\FilterUsingXForwardedHeadersFactory` and related configuration to fine-tune which sources may be considered for usage of these headers. + +## Support for OpenSwoole 22.0.x + +INFO: Since 4.10.0 mezzio-swoole supports the use of openswoole PHP extension version 22.0 and later. + +If your application has custom code that re-implements the function `swoole_set_process_name` then make sure to remove it. +This package will take care of the compatibility issues.