-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP-WASM: improve phar support (Asyncify error – null function or function signature mismatch) #1241
Comments
It could be an Asyncify issue, but it could also be dispatching another PHP Request before the previous one finished running – I can see |
It's nice how detailed the error stack trace is, with helpful clues to what happened. I suppose it might help with investigating deeper if the example is not using a PHAR file but a folder of PHP files. Then parts of it could be commented out, or place an exit at various points, to narrow down the specific code that leads to the error. So I'll try simplifying the example to get closer to the cause. |
OK, I tested by running PHPUnit from a Composer-installed vendor folder, and there is no WASM error. So the issue seems specific to the PHAR file. I've updated the example repo to demonstrate the difference: For the latter, it ends with "Program terminated with exit(1)". After digging in the PHPUnit code, I found that this is expected behavior: here, the CLI exits with code For reference, I'll include the stack trace below. What's interesting is that everything is working correctly, but it still shows the "cause" of the error as
The PHAR example doesn't show the help screen, so the WASM error must be happening before it. Well, I can work around this issue by using vendored files instead of PHAR, but I'm curious to try if the error still happens with a minimal/empty PHAR file. |
I added a more minimal example running the PHPUnit PHAR file with PHP-WASM only, not It displays a different help screen with colors, and exit code
|
OK, I narrowed down the cause of the issue further. Created an even more minimal example (repo) using git clone https://github.com/eliot-akira/wp-now-phar-example
cd wp-now-phar-example
npm install
npm run start
WASM ERROR
null function or function signature mismatch So the issue is not related to PHPUnit, but simply running PHAR with The same PHAR file can be run using npm run start:php-wasm
Hello from example. |
Fantastic reproduction case @eliot-akira, thank you! I'm marking as high priority crash. It seems like we're not getting all the stack trace functions somehow, similarly as in #1273. I wonder if, for Node.js, we could just switch to JSPI and solve all these problems in one go. They would still occur on the web, but hopefully to a lesser extent. I'll start a new issue. |
I tried to run a
The two missing functions where :
I added them in I am not sure if this will make every PHAR file run, but it can be a small step toward the solution. @adamziel should I suggest a PR ? |
@mho22 a PR would be lovely, thank you! |
Solved in #1716 |
I'm trying to run PHPUnit (in PHAR format) using
wp-now
, and encountered an error from@php-wasm/node
. I prepared an example repo that reproduces the issue.git clone https://github.com/eliot-akira/wp-now-phpunit-example cd wp-now-phpunit-example npm install npm run start
The error message:
The text was updated successfully, but these errors were encountered: