-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
When exit;
is called and the headers have not yet been flushed the CGI response is completely empty.
The issue seems to be that the shutdown procedures are not called on exit;
.
Reproduction
<?php
// test-exit-flush-fail.php
header('X-Test: 123');
exit;
<?php
// test-exit-flush-ok.php
header('X-Test: 123');
// Note: at least one byte needs to be sent.
echo "X";
exit;
When I run the scripts with a native php-cgi binary it produces the expected CGI responses.
> docker run --rm -ti -v $PWD:/app php:7.4.32-cli /usr/local/bin/php-cgi /app/test-exit-flush-ok.php
X-Powered-By: PHP/7.4.32
X-Test: 123
Content-type: text/html; charset=UTF-8
X
> docker run --rm -ti -v $PWD:/app php:7.4.32-cli /usr/local/bin/php-cgi /app/test-exit-flush-fail.php
X-Powered-By: PHP/7.4.32
X-Test: 123
Content-type: text/html; charset=UTF-8
But when I run the test-exit-flush-fail.php
with wasmtime
it fails to produce a CGI response.
> wasmtime --mapdir=./::./ php-cgi -- test-exit-flush-ok.php
X-Powered-By: PHP/7.4.32
X-Test: 123
Content-type: text/html; charset=UTF-8
X
> wasmtime --mapdir=./::./ php-cgi -- test-exit-flush-fail.php
Metadata
Metadata
Assignees
Labels
No labels