Skip to content

Commit

Permalink
Compatible with PHP 8.4 - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman committed Aug 29, 2024
1 parent a57869e commit d58d6c0
Show file tree
Hide file tree
Showing 5 changed files with 1,121 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,8 @@ EOF
thirdparty/php/sockets/conversions.cc \
thirdparty/php/sockets/sockaddr_conv.cc \
thirdparty/php/standard/var_decoder.cc \
thirdparty/php/standard/proc_open.cc"
thirdparty/php/standard/proc_open.cc \
thirdparty/php84/hash/hash_sha.c"

swoole_source_file="$swoole_source_file \
thirdparty/swoole_http_parser.c \
Expand Down Expand Up @@ -1232,6 +1233,7 @@ EOF
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php/sockets)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php/standard)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php/curl)
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/hash)
if test "$PHP_NGHTTP2_DIR" = "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/nghttp2)
fi
Expand Down
59 changes: 59 additions & 0 deletions tests/swoole_http_server/exit.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--TEST--
swoole_http_server: exit function
--SKIPIF--
<?php
if (PHP_VERSION_ID < 80400) {
require __DIR__ . '/../include/skipif.inc';
skip('php version 8.4 or higher');
}
?>
--FILE--
<?php
require __DIR__ . '/../include/bootstrap.php';

$pm = new ProcessManager;
$pm->parentFunc = function () use ($pm) {
Co\run(function () use ($pm) {
httpRequest("http://127.0.0.1:{$pm->getFreePort()}");
});

$pm->kill();
echo "DONE\n";
};

$pm->childFunc = function () use ($pm) {
$http = new Swoole\Http\Server('127.0.0.1', $pm->getFreePort(), SWOOLE_BASE);
$http->on('workerStart', function () use ($pm) {
$pm->wakeup();
});

$http->on('request', function (Swoole\Http\Request $request, Swoole\Http\Response $response) use ($pm) {
try {
exit('Swoole Server exit!!!');
} catch (Exception $e) {
echo $e->getMessage().PHP_EOL;
}

try {
exit();
} catch (Exception $e) {
echo $e->getMessage().PHP_EOL;
}

try {
exit(400);
} catch (Exception $e) {
echo $e->getStatus().PHP_EOL;
}
$response->end();
});
$http->start();
};
$pm->childFirst();
$pm->run();
?>
--EXPECTF--
Swoole Server exit!!!
swoole exit
400
DONE
Loading

0 comments on commit d58d6c0

Please sign in to comment.