diff --git a/packages/php-wasm/compile/Dockerfile b/packages/php-wasm/compile/Dockerfile index cbb826a920..3f8353b945 100644 --- a/packages/php-wasm/compile/Dockerfile +++ b/packages/php-wasm/compile/Dockerfile @@ -665,7 +665,8 @@ RUN if [ "$WITH_WS_NETWORKING_PROXY" = "yes" ]; \ "dynCall_viiiii",\ "dynCall_viiiiiii",\ "dynCall_viiiiiiii",'; \ - export ASYNCIFY_ONLY=$'"zif_array_filter",\"__fwritex",\ + export ASYNCIFY_ONLY=$'"zif_array_filter",\ +"__fwritex",\ "zif_sleep",\ "zif_stream_get_contents",\ "php_stdiop_read",\ @@ -970,7 +971,7 @@ RUN if [ "$WITH_WS_NETWORKING_PROXY" = "yes" ]; \ if [ "${PHP_VERSION:0:1}" -lt "8" ]; then \ export ASYNCIFY_ONLY="$ASYNCIFY_ONLY,"$(echo "$ASYNCIFY_ONLY" | sed -E $'s/"([a-zA-Z])/"byn$fpcast-emu$\\1/g'); \ fi; \ - echo -n ' -s ASYNCIFY_ONLY=['$ASYNCIFY_ONLY_UNPREFIXED$ASYNCIFY_ONLY'] '| tr -d "\n" >> /root/.emcc-php-wasm-flags; \ + echo -n ' -s ASYNCIFY_ONLY=['$ASYNCIFY_ONLY_UNPREFIXED$ASYNCIFY_ONLY'] '| tr -d "\n" >> /root/.emcc-php-wasm-flags; \ fi; # Build the final .wasm file @@ -1143,7 +1144,7 @@ RUN set -euxo pipefail; \ # Make the php.wasm URL configurable via the dependencyFilename loader argument: /root/replace.sh $'s/["\']php\.wasm[\'"]/dependencyFilename/g' /root/output/php.js; \ # Patch a "property undefined" error - # Emscripten produces an if that checkes a stream.stream_ops.poll property. However, + # Emscripten produces an if that checks a stream.stream_ops.poll property. However, # stream.stream_ops is sometimes undefined and the check fails. Let's adjust it to # tolerate a null stream.stream_ops value. /root/replace.sh "s/if\s*\(stream\.stream_ops\.poll\)/if (stream.stream_ops?.poll)/g" /root/output/php.js; \ @@ -1155,10 +1156,12 @@ RUN set -euxo pipefail; \ /root/replace.sh $'s/if\s*\(\s*["\']string["\']\s*===\s*typeof Module\[["\']websocket["\']\]\[["\']url["\']\]\s*\)/if("function"===typeof Module["websocket"]["url"]) {\nurl = Module["websocket"]["url"](...arguments);\n}else if ("string" === typeof Module["websocket"]["url"])/g' \ /root/output/php.js; \ # Enable custom WebSocket constructors to support socket options. - /root/replace.sh "s/ws\s*=\s*new WebSocketConstructor/if (Module['websocket']['decorator']) {WebSocketConstructor = Module['websocket']['decorator'](WebSocketConstructor);}ws = new WebSocketConstructor/g" /root/output/php.js; \ + /root/replace.sh "s/ws\s*=\s*new WebSocketConstructor/if (Module['websocket']['decorator']) {WebSocketConstructor = Module['websocket']['decorator'](WebSocketConstructor);}ws = new WebSocketConstructor/g" /root/output/php.js && \ + if [ "$EMSCRIPTEN_ENVIRONMENT" = "node" ]; then \ if [ "$WITH_WS_NETWORKING_PROXY" = "yes" ]; then \ /root/replace.sh "s/sock\.server\s*=\s*new WebSocketServer/if (Module['websocket']['serverDecorator']) {WebSocketServer = Module['websocket']['serverDecorator'](WebSocketServer);}sock.server = new WebSocketServer/g" /root/output/php.js; \ fi; \ + fi; \ # Add MSG_PEEK flag support in recvfrom # # Emscripten ignores the flags argument to ___syscall_recvfrom.