[PHP][Node] Export more side-module symbols to support the SQLite WASM extension (#3605) - #3605
Conversation
|
Local validation after adding
One non-runtime note: PHP 8.5 prints a deprecation warning from Reprint's verification helper for |
|
Pushed the generated node JSPI PHP runtime binaries as well:
Validation after restoring the binaries into the repo:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Exports additional libc/pthread and Zend symbols from the PHP.wasm main module so the SQLite Integration Rust side module (wp_mysql_parser) can dynamically link under JSPI PHP 8.3+.
Changes:
- Added missing libc/pthread + PHP 8+ Zend symbol exports to the side-module export list (both the reference TU and linker export list).
- Updated
.dockerignoreto include only extension side modules in the Docker build context so the link step can preserve their imports. - Bumped supported PHP patch release metadata and refresh timestamp.
Reviewed changes
Copilot reviewed 4 out of 18 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/php-wasm/supported-php-versions.mjs | Updates patch versions and refresh timestamp for supported PHP builds. |
| packages/php-wasm/compile/php/zend-side-module-exports.c | References additional libc/pthread/Zend symbols to force them into the main module exports. |
| packages/php-wasm/compile/php/Dockerfile | Adds the same symbols to the --export list used by the linker via .WASM_ABI_EXPORTS. |
| packages/php-wasm/.dockerignore | Re-includes only extension side-module assets from node-builds/ and web-builds/ in Docker build context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| */ | ||
|
|
||
| export const lastRefreshed = '2026-04-24T16:57:46.127Z'; | ||
| export const lastRefreshed = '2026-05-07T07:40:54.656Z'; |
| echo 'destroy_op_array'; \ | ||
| echo '_efree'; \ | ||
| echo '_zend_bailout'; \ | ||
| echo 'getentropy'; \ | ||
| echo 'posix_memalign'; \ | ||
| echo 'pthread_cond_signal'; \ | ||
| echo 'pthread_cond_wait'; \ | ||
| echo 'pthread_condattr_destroy'; \ | ||
| echo 'pthread_condattr_init'; \ | ||
| echo 'pthread_condattr_setclock'; \ | ||
| echo 'pthread_mutex_trylock'; \ | ||
| echo 'pthread_mutexattr_destroy'; \ | ||
| echo 'pthread_mutexattr_init'; \ | ||
| echo 'pthread_mutexattr_settype'; \ | ||
| echo 'sched_yield'; \ | ||
| echo 'writev'; \ | ||
| if [ "$PHP_VERSION_MAJOR" -ge 8 ]; then \ | ||
| echo 'zend_array_count'; \ | ||
| echo 'zend_declare_property'; \ | ||
| echo 'zend_do_implement_interface'; \ | ||
| echo 'zend_hash_get_current_key_zval_ex'; \ | ||
| echo 'zend_is_callable'; \ | ||
| echo 'zend_is_iterable'; \ | ||
| echo 'zend_lookup_class_ex'; \ | ||
| echo 'zend_objects_new'; \ | ||
| echo 'zend_register_internal_interface'; \ | ||
| echo 'zend_std_get_properties'; \ | ||
| echo 'zend_std_has_property'; \ | ||
| echo 'zend_std_read_property'; \ | ||
| echo 'zend_std_write_property'; \ | ||
| echo 'zend_throw_exception_object'; \ | ||
| fi; \ |
What it does
Allows JSPI PHP runtimes to load the SQLite Integration Rust
wp_mysql_parserside module by exporting the native symbols it imports from PHP.wasm.Rationale
The parser side module currently fails under the published PHP 8.3 runtime because the dynamic linker cannot resolve several libc/pthread and Zend symbols.
MAIN_MODULE=2only exports symbols explicitly requested during the PHP build, so the functions must be both referenced fromzend-side-module-exports.cand passed to the linker as--exportentries.Implementation
Adds the missing libc/pthread exports and PHP 8+ Zend exports to the JSPI side-module export list.
Also updates
packages/php-wasm/.dockerignoreso PHP rebuilds can copy existing extension side modules into the Docker build context. The link step scans those.sofiles to preserve symbols imported by bundled extensions, but the previous ignore rules filtered outnode-builds/web-buildsentirely in sparse checkouts.Testing instructions
Validated locally with a rebuilt Node JSPI PHP 8.3 runtime:
PATH="/tmp/playground-podman-bin:$PATH" npm run recompile:php:node:jspi:8.3Then compared the rebuilt runtime exports against the SQLite parser side module:
Replaced Reprint's local
@php-wasm/node-8-3/jspitest runtime with the rebuilt artifact and verified the native extension path:Both passed. Parser mode verified
WP_MySQL_Native_Parser_Nodeand theWP_PDO_MySQL_On_SQLite::create_parser()native-backed AST path.Focused Reprint benchmark with 1,000 posts / 2,500 postmeta rows also passed after forcing the benchmark wrapper to use Node 24 for JSPI:
Local notes: this machine had no Docker daemon, so the PHP rebuild used a rootless Podman wrapper. I had to reset stale Reprint e2e fixture state and install the exporter plugin Composer dependencies before the benchmark source site would provision cleanly.