-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensures the Blueprint steps throw an error on failure. For now, the error is merely reported in the console. In the future, there may be a nice UI for this. This PR is an addition to #605 as it prepares the Blueprint steps for the changes in the Blueprint compilation engine. Detecting a runPHP failure required adjusting the php_wasm.c code to return the correct exit code. The previous method of inferring the exit code was replaced by simply returning `EG(exit_status)` which is populated by the zend engine. Furthermore, this PR ships additional unit tests for some Blueprint steps to ensure they indeed throw as expected. ## Changes description ### `throwOnError` option `BasePHP.run()` now accepts a `throwOnError` option that throws an error whenever PHP returns an exit code different than `0`: ```js // This will throw a JavaScript exception await php.run({ throwOnError: true, code: '<?php no_such_function()' }); ``` This happens in the following cases: * syntax error * undefined function call * fatal error * calling `exit(1)` * uncaught PHP exception * ...probably some more This option is set to `true` by all the Blueprint steps. ## Remaining work - [x] Rebuild all the PHP.wasm versions ## Testing instructions This PR comes with test coverage so confirm all the tests pass in CI. Also, apply this PR locally and visit the following URL: http://localhost:5400/website-server/#{%22steps%22:[{%22step%22:%22runPHP%22,%20%22code%22:%22%3C?php%20no_such_fn();%22}]} It should reveal useful error information in the console.
- Loading branch information
Showing
83 changed files
with
575 additions
and
169 deletions.
There are no files selected for viewing
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file modified
BIN
+54 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/7_0_33/php_7_0.wasm
Binary file not shown.
Binary file modified
BIN
-114 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/7_1_30/php_7_1.wasm
Binary file not shown.
Binary file modified
BIN
-31 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/7_2_34/php_7_2.wasm
Binary file not shown.
Binary file modified
BIN
-40 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/7_3_33/php_7_3.wasm
Binary file not shown.
Binary file modified
BIN
-39 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/7_4_33/php_7_4.wasm
Binary file not shown.
Binary file modified
BIN
-59 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/8_0_30/php_8_0.wasm
Binary file not shown.
Binary file modified
BIN
-45 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/8_1_23/php_8_1.wasm
Binary file not shown.
Binary file modified
BIN
-53 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/8_2_10/php_8_2.wasm
Binary file not shown.
Binary file modified
BIN
-55 Bytes
(100%)
packages/php-wasm/web/public/kitchen-sink/8_3_0/php_8_3.wasm
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
packages/playground/blueprints/src/lib/steps/activate-plugin.ts
Oops, something went wrong.
Oops, something went wrong.
51 changes: 39 additions & 12 deletions
51
packages/playground/blueprints/src/lib/steps/apply-wordpress-patches/index.ts
Oops, something went wrong.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
packages/playground/blueprints/src/lib/steps/define-wp-config-consts.ts
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
packages/playground/blueprints/src/lib/steps/enable-multisite.spec.ts
Oops, something went wrong.
37 changes: 27 additions & 10 deletions
37
packages/playground/blueprints/src/lib/steps/enable-multisite.ts
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
packages/playground/blueprints/src/lib/steps/import-wordpress-files.ts
Oops, something went wrong.
Oops, something went wrong.
37 changes: 14 additions & 23 deletions
37
packages/playground/blueprints/src/lib/steps/install-plugin.ts
Oops, something went wrong.
36 changes: 12 additions & 24 deletions
36
packages/playground/blueprints/src/lib/steps/install-theme.ts
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
packages/playground/blueprints/src/lib/steps/login.spec.ts
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
packages/playground/blueprints/src/lib/steps/rewrite-wp-config-to-define-constants.php
Oops, something went wrong.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
packages/playground/blueprints/src/lib/steps/run-php.spec.ts
Oops, something went wrong.
Oops, something went wrong.
57 changes: 23 additions & 34 deletions
57
packages/playground/blueprints/src/lib/steps/site-data.ts
Oops, something went wrong.
10 changes: 2 additions & 8 deletions
10
packages/playground/blueprints/src/lib/utils/run-php-with-zip-functions.ts
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.