Add PHP 5.6 WebAssembly build support for legacy WordPress versions#3284
Closed
adamziel wants to merge 1 commit intoWordPress:trunkfrom
Closed
Add PHP 5.6 WebAssembly build support for legacy WordPress versions#3284adamziel wants to merge 1 commit intoWordPress:trunkfrom
adamziel wants to merge 1 commit intoWordPress:trunkfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds build system support for compiling PHP 5.6 to WebAssembly, enabling WordPress Playground to run legacy WordPress versions (1.x through 4.x) that require PHP 5.2+. PHP 5.6 is backward compatible with PHP 5.2 code, providing a single legacy binary for all older WordPress releases.
Changes:
- Added PHP 5.x version guards and compatibility stubs to C extensions (proc_open, dns_polyfill, post_message_to_js, wasm_memory_storage)
- Created NX project scaffolding for
@php-wasm/node-5-6and@php-wasm/web-5-6packages - Added separate legacy PHP test suite with 12 tests covering core functionality
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.base.json | Added TypeScript path aliases for PHP 5.6 node and web packages |
| packages/php-wasm/web/src/lib/get-php-loader-module.ts | Added case '5.6' to web loader module switch |
| packages/php-wasm/node/src/lib/get-php-loader-module.ts | Added case '5.6' to node loader module switch |
| packages/php-wasm/universal/src/lib/supported-php-versions.ts | Added LegacyPHPVersions export and type |
| packages/php-wasm/universal/src/lib/index.ts | Exported LegacyPHPVersions and LegacyPHPVersion type |
| packages/php-wasm/supported-php-versions.mjs | Added PHP 5.6 entry to phpVersions array |
| packages/php-wasm/node/src/test/legacy-php-versions.spec.ts | Created comprehensive test suite for legacy PHP versions |
| packages/php-wasm/web-builds/5-6/* | Created complete package structure for web PHP 5.6 build |
| packages/php-wasm/node-builds/5-6/* | Created complete package structure for node PHP 5.6 build |
| packages/php-wasm/compile/php/proc_open.* | Added PHP 5.x stub implementation for proc_open functions |
| packages/php-wasm/compile/php/php5.6.patch | Added PHP 5.6-specific patch for empty file copy issue |
| packages/php-wasm/compile/php/apply-mysqlnd-patch.sh | Made script tolerant of missing mysqlnd in PHP 5.x |
| packages/php-wasm/compile/php/Dockerfile | Added version guards for fiber-asm, imagick, chunk-alloc, asm arithmetic, and cli_server |
| packages/php-wasm/compile/php-wasm-memory-storage/wasm_memory_storage.c | Added PHP 5.x no-op implementation |
| packages/php-wasm/compile/php-wasm-dns-polyfill/dns_polyfill.c | Added PHP 5.x compatibility with TSRMLS_CC and type adjustments |
| packages/php-wasm/compile/php-post-message-to-js/post_message_to_js.c | Added PHP 5.x compatibility for string return handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
93e68b1 to
309db6e
Compare
Enable compiling PHP 5.6 to WebAssembly so WordPress Playground can run
WordPress 1.x through 4.x, which require PHP 5.2+. PHP 5.6 is backward
compatible with PHP 5.2 code, so a single legacy version covers all older
WordPress releases.
Changes:
- Dockerfile: Add PHP 5.x version guards (fiber-asm, imagick, chunk-alloc
patches, ASM arithmetic, cli_server)
- C sources: Add PHP 5.x compatibility for proc_open, dns_polyfill,
post_message_to_js, and wasm_memory_storage extensions
- Package scaffolding: node-builds/5-6 and web-builds/5-6 with full NX
project configuration
- Loader modules: Add case '5.6' to node and web getPHPLoaderModule()
- Version registry: Add PHP 5.6 to supported-php-versions.mjs and
LegacyPHPVersions in supported-php-versions.ts (separate from
SupportedPHPVersions to avoid test regressions)
- Test suite: Dedicated legacy-php-versions.spec.ts with 12 tests
covering execution, file I/O, networking, proc_open, SQLite, JSON,
sessions, mbstring, error handling, memory, and filesystem ops
- tsconfig.base.json: Path aliases for new packages
Note: WASM binaries must be compiled in a Docker-enabled environment:
node packages/php-wasm/compile/build.js --PLATFORM=node --PHP_VERSION=5.6 \
--WITH_IMAGICK=no --WITH_OPCACHE=no
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
309db6e to
d17b229
Compare
This was referenced Mar 14, 2026
Collaborator
|
@JanJakes Do you think we can close this pull request now that you implemented 5.2 ? |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Build system (Dockerfile + C sources):
proc_open,dns_polyfill,post_message_to_js, andwasm_memory_storageextensions for PHP 5.x compatibilityphp5.6.patchfor Emscripten-specific fixesapply-mysqlnd-patch.shtolerant of PHP 5.x (different API)Package scaffolding:
packages/php-wasm/node-builds/5-6/andweb-builds/5-6/with full NX project configurationcase '5.6'to node and webgetPHPLoaderModule()loader modulesLegacyPHPVersionsexport (separate fromSupportedPHPVersionsto avoid test regressions)Test suite:
legacy-php-versions.spec.tswith 12 tests covering: version verification, execution, file I/O, networking, proc_open, SQLite, JSON, sessions, mbstring, error handling, memory, and filesystemNext step: compile WASM binaries
The WASM binaries must be compiled in a Docker-enabled environment:
Test plan
php-wasm-node-5-6andphp-wasm-web-5-6projects🤖 Generated with Claude Code