Skip to content

Commit

Permalink
PHP: Reset exit code before dispatching a request (#1251)
Browse files Browse the repository at this point in the history
Ensures PHP returns the correct exit code after each request. Without
this PR, hitting an exit code 255 once means PHP will continue returning
it indefinitely.

Related to #1249

## Testing instructions

Confirm the unit tests pass (they won't until all PHP versions are
rebuilt and shipped with this PR)

cc @kozer

---------

Co-authored-by: Brandon Payton <brandon@happycode.net>
  • Loading branch information
adamziel and brandonpayton authored Apr 16, 2024
1 parent d098173 commit 5dcabdd
Show file tree
Hide file tree
Showing 55 changed files with 49 additions and 26 deletions.
2 changes: 2 additions & 0 deletions packages/php-wasm/compile/php/php_wasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,8 @@ int EMSCRIPTEN_KEEPALIVE wasm_sapi_handle_request()
result = -1;
goto wasm_request_done;
}

EG(exit_status) = 0;

TSRMLS_FETCH();
if (wasm_server_context->execution_mode == MODE_EXECUTE_SCRIPT)
Expand Down
Binary file modified packages/php-wasm/node/public/7_0_33/php_7_0.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/7_1_30/php_7_1.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/7_2_34/php_7_2.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/7_3_33/php_7_3.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/7_4_33/php_7_4.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/8_0_30/php_8_0.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/8_1_23/php_8_1.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/8_2_10/php_8_2.wasm
Binary file not shown.
Binary file modified packages/php-wasm/node/public/8_3_0/php_8_3.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_7_0.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/7_0_33/php_7_0.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 12778840;
export const dependenciesTotalSize = 12778913;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_7_1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/7_1_30/php_7_1.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 13301175;
export const dependenciesTotalSize = 13300912;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_7_2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/7_2_34/php_7_2.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 13992133;
export const dependenciesTotalSize = 13992092;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_7_3.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/7_3_33/php_7_3.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 14098611;
export const dependenciesTotalSize = 14098607;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_7_4.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/7_4_33/php_7_4.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 14331012;
export const dependenciesTotalSize = 14331074;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_8_0.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/8_0_30/php_8_0.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 13597816;
export const dependenciesTotalSize = 13597709;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
2 changes: 1 addition & 1 deletion packages/php-wasm/node/public/php_8_1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dependencyFilename = __dirname + '/8_1_23/php_8_1.wasm';
export { dependencyFilename };
export const dependenciesTotalSize = 13575986;
export const dependenciesTotalSize = 13575971;
export function init(RuntimeName, PHPLoader) {
/**
* Overrides Emscripten's default ExitStatus object which gets
Expand Down
Loading

0 comments on commit 5dcabdd

Please sign in to comment.