Skip to content

Commit 6f4f269

Browse files
seanmorrisadamziel
andauthored
Prevent memory leaks on reinstantiation, open up cookies, fix compilation of php >=7.4 (#639)
WordPress/playground-tools#110 depends on this PR: **Allow PHP instances to stop & restart without leaking memory.** * Expose PHP's exit() function to javascript to allow instances to be shutdown and garbage collected. * Tweaks load-php-runtime.ts to delete local references to instances upon shutdown. **Allow calling code to access cookies inside PHPBrowser** * `PHPBrowser`'s `setCookies` & `serializeCookies` are no longer private methods, allowing multiple instances to share the same login. **Allow PHP >= 7.4 to compile without failure.** * ~~Patches were updated for PHP >=7.4 to account for deprecated macros: php/php-src#11678 * All versions of PHP >= 8.0 have been updated to the latest minor versions, necessitating some tweaks to the existing patch lines. **EMSDK Version Locked** * Emsdk is now locked to use version `3.1.43` rather than `latest`. This makes the dockerfile deterministic, as minor version updates to emscripten are not always 100% 1:1 compatible. * Recommend not updating that value without running tests first. A dockerfile is a lot like a lockfile. Versions should be committed. **Dockerfile Re-ordering** * Moved steps that use PHP_VERSION as far down as possible. All previous steps are identical, so a build of all PHP versions can re-use all these layers from cache. Conversely, if a previous layer uses PHP_VERSION, they will not be considered the same and the cache will not apply. Ordering the build in this way should speed things up a bit as now it can skip to step 54 after running those for the first build. * OpenSSL no longer copies `man` page documentation as part of the build process, as this is relatively pointless inside a build container. **Sourcemaps & Debugging** * The directory structure where the final WASM files live has been shuffled a bit to account for sourcemaps. Sourcemaps may be now be built with `npm run recompile:php:node -- --WITH_SOURCEMAPS=yes`. PHP sources will be copied to each version directory, and sourcemaps can be loaded into chrome devtools via a right click on WASM disassembled code > add source map > `file://[ABSOLUTE LOCAL PATH TO .wasm.map FILE]` --------- Co-authored-by: Adam Zieliński <[email protected]>
1 parent 4523358 commit 6f4f269

File tree

92 files changed

+64464
-14628
lines changed

Some content is hidden

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

92 files changed

+64464
-14628
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ indent_size = 4
1111
[*.md]
1212
max_line_length = off
1313
trim_trailing_whitespace = false
14+
15+
[*.patch]
16+
trim_trailing_whitespace = false

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v3
2929
- uses: ./.github/actions/prepare-playground
30-
- run: npx nx affected --target=test --configuration=ci
30+
- run: node --expose-gc node_modules/nx/bin/nx affected --target=test --configuration=ci
3131
build:
3232
runs-on: ubuntu-latest
3333
needs: [lint-and-typecheck]

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"recompile:php:node:8.1": "nx recompile-php php-wasm-node --PHP_VERSION=8.1",
4444
"recompile:php:node:8.2": "nx recompile-php php-wasm-node --PHP_VERSION=8.2",
4545
"release": "lerna publish patch --yes --no-private --loglevel=verbose",
46-
"test": "nx run-many --all --target=test",
46+
"test": "node --expose-gc node_modules/nx/bin/nx run-many --all --target=test",
4747
"fix-asyncify": "node packages/php-wasm/node/bin/rebuild-while-asyncify-functions-missing.mjs",
4848
"typecheck": "nx run-many --all --target=typecheck",
4949
"prepare": "husky install"

0 commit comments

Comments
 (0)