wordpress-playground icon indicating copy to clipboard operation
wordpress-playground copied to clipboard

@php-wasm/universal : Add Phar support in php-wasm

Open mho22 opened this issue 1 year ago • 5 comments

Based on issue #1241.

This is an initial pull request version. I may need further guidance to ensure it is ready for merging.

mho22 avatar Aug 29 '24 15:08 mho22

@adamziel I'm currently trying to run the composer PHAR file in php-wasm/web, but I'm encountering the following stack trace when running php.cli( [ 'php', 'composer.phar', 'install' ] );:

Uncaught (in promise) RuntimeError: null function or function signature mismatch
    at 032749f6:0xdfebf
    at 032749f6:0x7e623
    at 032749f6:0x2c68d9
    at 032749f6:0x6a6ec2
    at 032749f6:0x707bcc
    at 032749f6:0x74b9b4
    at 032749f6:0x2e9fbe
    at 032749f6:0x6eb13e
    at 032749f6:0x6ae8a1
    at ret.<computed> (php_8_2.js:43:72504)Caused by: Error
    at Asyncify.handleSleep (php_8_2.js:60:49)
    at _emscripten_sleep (php_8_2.js:43:39745)
    at 032749f6:0xddacd
    at 032749f6:0x6a6dbe
    at 032749f6:0x707bcc
    at 032749f6:0x74b9b4
    at 032749f6:0x2e9fbe
    at 032749f6:0x6eb13e
    at 032749f6:0x6ae8a1
    at ret.<computed> (php_8_2.js:43:72504)

with :

Uncaught RuntimeError: unreachable
    at 032749f6:0x6e6706
    at ret.<computed> (php_8_2.js:43:72504)
    at t.wasmExports.<computed> (index.js:522:18)
    at Object.doRewind (php_8_2.js:43:74168)
    at php_8_2.js:43:74741
    at callUserCallback (php_8_2.js:43:37432)
    at php_8_2.js:43:39676Caused by: Error
    at Asyncify.handleSleep (php_8_2.js:60:49)
    at _emscripten_sleep (php_8_2.js:43:39745)
    at 032749f6:0xddacd
    at 032749f6:0x6a6dbe
    at 032749f6:0x707bcc
    at 032749f6:0x74b9b4
    at 032749f6:0x2e9fbe
    at 032749f6:0x6eb13e
    at 032749f6:0x6ae8a1
    at ret.<computed> (php_8_2.js:43:72504)

This stack trace looks somewhat familiar but is obviously hard to read. Do you have any insights or suggestions on how to make this more debuggable?

mho22 avatar Sep 02 '24 14:09 mho22

@mho22 the Node.js build should give you the same error with all the c function names. I would so love to start shipping the JSPI build to the browser ms and server side environments that support it as it would solve all such errors in one swoop.

adamziel avatar Sep 03 '24 06:09 adamziel

@adamziel I made a mistake. I solved it and here is what returns php-wasm/web when I run php.cli( [ 'php', 'composer.phar', 'install' ] ) now :

Capture d’écran 2024-09-03 à 09 14 08

   

With [#1093] implementation :

Capture d’écran 2024-09-03 à 14 07 43

   

And here is what returns php-wasm/node when I run php.cli( [ 'php', 'composer.phar', 'install' ] ) :

Capture d’écran 2024-09-03 à 09 14 27

   

This looks promising for the pull request I think.

mho22 avatar Sep 03 '24 07:09 mho22

In my quest to correct the errors above I found out other elements to add into the Asyncify functions list :

"Curl_proxy_connect",\
"call_extract_if_dead",\
"Curl_conncache_foreach",\

Should I update the current pull request ?

mho22 avatar Sep 03 '24 17:09 mho22

Should I update the current pull request ?

Yes please, especially since we've had another .wasm updating PR merged in the meantime and there are wasm merge conflicts.

adamziel avatar Sep 06 '24 18:09 adamziel

@adamziel done 👌

mho22 avatar Sep 08 '24 09:09 mho22

@adamziel My apologies. The conflicts have been resolved. But test-e2e and build failed?

mho22 avatar Sep 10 '24 09:09 mho22

It seems like they passed after rebasing. Thank you @mho22!

adamziel avatar Sep 11 '24 16:09 adamziel