Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ jobs:
- name: Run container structure tests
run: container-structure-test test --image utopia-base-test --config tests.yaml

- name: Check Swoole upload marker handling
run: docker run --rm -v "$PWD/tests-swoole.php:/tests-swoole.php:ro" utopia-base-test php /tests-swoole.php

dive:
name: Dive (${{ matrix.php-versions }})
needs: build
Expand Down
28 changes: 28 additions & 0 deletions tests-swoole.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

// Swoole must not treat a client's Swoole-Upload-File part header as an upload and
// unlink the path it names (swoole/swoole-src#6309, fixed in v6.2.5).
$target = '/tmp/target';
touch($target);
$status = 0;

$server = new Swoole\Http\Server('127.0.0.1', 9501);
$server->set(['worker_num' => 1, 'log_level' => SWOOLE_LOG_ERROR]);
$server->on('request', fn ($request, $response) => $response->end());
$server->on('start', function ($server) use ($target, &$status) {
go(function () use ($server, $target, &$status) {
$body = "--b\r\nContent-Disposition: form-data; name=\"file\"; filename=\"f.bin\"\r\n"
. "Swoole-Upload-File: {$target}\r\nContent-Type: application/octet-stream\r\n\r\nabc\r\n--b--\r\n";
$client = new Swoole\Coroutine\Http\Client('127.0.0.1', 9501);
$client->setHeaders(['Content-Type' => 'multipart/form-data; boundary=b']);
$client->post('/', $body);
Swoole\Coroutine::sleep(0.5);
$status = $client->statusCode;
$server->shutdown();
});
});
$server->start();

$kept = file_exists($target);
echo "status {$status}, target ", $kept ? 'kept' : 'deleted', PHP_EOL;
exit($status === 200 && $kept ? 0 : 1);
2 changes: 1 addition & 1 deletion versions/8.3.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PHP_VERSION=8.3
ALPINE_VERSION=3.23
PHP_API=20230831
PHP_REDIS_VERSION=6.3.0
PHP_SWOOLE_VERSION=v6.2.4
PHP_SWOOLE_VERSION=v6.2.5
PHP_IMAGICK_VERSION=3.8.1
PHP_YAML_VERSION=2.3.0
PHP_MAXMINDDB_VERSION=v1.12.0
Expand Down
2 changes: 1 addition & 1 deletion versions/8.4.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PHP_VERSION=8.4
ALPINE_VERSION=3.23
PHP_API=20240924
PHP_REDIS_VERSION=6.3.0
PHP_SWOOLE_VERSION=v6.2.4
PHP_SWOOLE_VERSION=v6.2.5
PHP_IMAGICK_VERSION=3.8.1
PHP_YAML_VERSION=2.3.0
PHP_MAXMINDDB_VERSION=v1.12.0
Expand Down
2 changes: 1 addition & 1 deletion versions/8.5.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PHP_VERSION=8.5.12
ALPINE_VERSION=3.23
PHP_API=20250925
PHP_REDIS_VERSION=6.3.0
PHP_SWOOLE_VERSION=v6.2.4
PHP_SWOOLE_VERSION=v6.2.5
PHP_IMAGICK_VERSION=3.8.1
PHP_YAML_VERSION=2.3.0
PHP_MAXMINDDB_VERSION=v1.12.0
Expand Down
Loading