Skip to content

Commit 91dc4b0

Browse files
committed
Use temp native dir for /wordpress and /internal
1 parent c7bc84c commit 91dc4b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+870
-372
lines changed

package-lock.json

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"react-redux": "8.1.3",
8888
"react-transition-group": "4.4.5",
8989
"sha.js": "2.4.11",
90+
"tmp-promise": "3.0.3",
9091
"wasm-feature-detect": "1.8.0",
9192
"xml2js": "0.6.2",
9293
"yargs": "17.7.2"

packages/php-wasm/compile/php/php_wasm.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ EM_JS(int, wasm_poll_socket, (php_socket_t socketd, int events, int timeout), {
241241
if (stream.stream_ops?.poll) {
242242
mask = stream.stream_ops.poll(stream, -1);
243243
}
244-
244+
245245
mask &= events | POLLERR | POLLHUP;
246246
if (mask) {
247247
return mask;
@@ -418,7 +418,7 @@ EM_JS(__wasi_errno_t, js_fd_read, (__wasi_fd_t fd, const __wasi_iovec_t *iov, si
418418
HEAPU32[pnum >> 2] = num;
419419
return wakeUp(returnCode);
420420
}
421-
421+
422422
// It's a blocking stream and we Blocking stream with no data available yet.
423423
// Let's poll up to a timeout.
424424
await new Promise(resolve => setTimeout(resolve, interval));
@@ -1026,8 +1026,8 @@ int main(int argc, char *argv[]);
10261026
int run_cli()
10271027
{
10281028
// See wasm_sapi_request_init() for details on why we need to redirect stdout and stderr.
1029-
stdout_replacement = redirect_stream_to_file(stdout, "/internal/stdout");
1030-
stderr_replacement = redirect_stream_to_file(stderr, "/internal/stderr");
1029+
stdout_replacement = redirect_stream_to_file(stdout, "/request/stdout");
1030+
stderr_replacement = redirect_stream_to_file(stderr, "/request/stderr");
10311031
if (stdout_replacement == -1 || stderr_replacement == -1)
10321032
{
10331033
return -1;
@@ -1337,7 +1337,7 @@ void wasm_set_request_port(int port)
13371337
*
13381338
* stream: The stream to redirect, e.g. stdout or stderr.
13391339
*
1340-
* path: The path to the file to redirect to, e.g. "/internal/stdout".
1340+
* path: The path to the file to redirect to, e.g. "/request/stdout".
13411341
*
13421342
* returns: The exit code: 0 on success, -1 on failure.
13431343
*/
@@ -1559,11 +1559,11 @@ int wasm_sapi_request_init()
15591559
// Write to files instead of stdout and stderr because Emscripten truncates null
15601560
// bytes from stdout and stderr, and null bytes are a valid output when streaming
15611561
// binary data.
1562-
// We use our custom Emscripten-defined /internal/std* devices and handle the output in JavaScript.
1562+
// We use our custom Emscripten-defined /request/std* devices and handle the output in JavaScript.
15631563
// These /internal devices are not thread-safe and should always stay in per-process MEMFS space.
15641564
// Sharing them between PHP instances may cause intertwined output.
1565-
stdout_replacement = redirect_stream_to_file(stdout, "/internal/stdout");
1566-
stderr_replacement = redirect_stream_to_file(stderr, "/internal/stderr");
1565+
stdout_replacement = redirect_stream_to_file(stdout, "/request/stdout");
1566+
stderr_replacement = redirect_stream_to_file(stderr, "/request/stderr");
15671567
if (stdout_replacement == -1 || stderr_replacement == -1)
15681568
{
15691569
return -1;
@@ -1821,7 +1821,7 @@ FILE *headers_file;
18211821
*/
18221822
static int wasm_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
18231823
{
1824-
headers_file = fopen("/internal/headers", "w");
1824+
headers_file = fopen("/request/headers", "w");
18251825
if (headers_file == NULL)
18261826
{
18271827
return FAILURE;

0 commit comments

Comments
 (0)