Skip to content

Export Zend symbols for PHP side modules#3690

Merged
adamziel merged 2 commits into
trunkfrom
adamziel/missoula-v1
May 27, 2026
Merged

Export Zend symbols for PHP side modules#3690
adamziel merged 2 commits into
trunkfrom
adamziel/missoula-v1

Conversation

@adamziel

@adamziel adamziel commented May 27, 2026

Copy link
Copy Markdown
Collaborator

What?

Exports the Zend symbols needed by PHP 8.x side-module extensions from the Playground JSPI main module:

  • _call_user_function_impl
  • zend_declare_class_constant_ex
  • zend_register_internal_class_ex

Also rebuilds the affected web JSPI artifacts:

  • packages/php-wasm/web-builds/8-0/jspi
  • packages/php-wasm/web-builds/8-1/jspi
  • packages/php-wasm/web-builds/8-4/jspi
  • packages/php-wasm/web-builds/8-5/jspi

Why?

The wp_mysql_parser extension built by WordPress/sqlite-database-integration loaded in the Node/CLI runtime but crashed the browser runtime for some PHP versions. The browser crash happened before WordPress booted because the side module imported Zend symbols that were not exported by the web PHP.wasm build.

Observed compatibility against the previous web builds:

  • PHP 8.2 and 8.3 already exported all required symbols.
  • PHP 8.0 and 8.1 missed zend_declare_class_constant_ex.
  • PHP 8.4 missed zend_declare_class_constant_ex and zend_register_internal_class_ex.
  • PHP 8.5 missed those two plus _call_user_function_impl.

The Node builds already exposed these symbols, so this aligns web with Node and allows external PHP extension manifests to support PHP 8.0 through 8.5 consistently.

Testing

  • Rebuilt web JSPI PHP artifacts for 8.0, 8.1, 8.4, and 8.5.
  • Ran git diff --check.
  • Verified the wp_mysql_parser side module imports are satisfied by the matching web runtime exports for PHP 8.0 through 8.5 using a local WebAssembly import/export comparison.

@adamziel adamziel marked this pull request as ready for review May 27, 2026 10:08
@adamziel adamziel requested review from a team, Copilot and zaerl May 27, 2026 10:08
@adamziel adamziel merged commit faf0a6b into trunk May 27, 2026
55 checks passed
@adamziel adamziel deleted the adamziel/missoula-v1 branch May 27, 2026 10:26
adamziel added a commit to WordPress/sqlite-database-integration that referenced this pull request May 27, 2026
## What?

Adds a browser-runtime compatibility check for the `wp_mysql_parser`
WASM side modules and wires it into both WASM workflows:

- `wasm-spike.yml`
- `publish-wasm-extension-artifact.yml`

The check compares each side module's `env` function imports against the
matching Playground web PHP.wasm runtime exports. It runs for PHP 8.0
through 8.5 so the published manifest cannot claim browser support for a
PHP version that will crash during extension startup.

Also updates the native extension README/demo URL to use the live
`blueprint.json` location and documents PHP 8.0-8.5 browser-runtime
coverage instead of the temporary PHP 8.3 pin.

## Why?

The previous Node-based smoke test was insufficient: PHP 8.4 loaded in
the Node/CLI runtime but crashed in the browser runtime because the web
runtime did not export Zend symbols imported by the extension side
module.

This PR makes that class of failure visible in CI before publishing a
WASM manifest.

## Dependency

This depends on WordPress/wordpress-playground#3690 and updated
Playground web PHP.wasm artifacts. Current Playground web builds are
known to miss required exports for PHP 8.0, 8.1, 8.4, and 8.5; the new
CI check is expected to pass once those runtime exports ship.

## Testing

- `node --check
packages/php-ext-wp-mysql-parser/wasm-spike/check-playground-web-compat.mjs`
- `git diff --check`
- Verified locally with the Playground checkout:
  - PHP 8.3 currently passes.
- PHP 8.4 currently fails with missing `zend_declare_class_constant_ex`
and `zend_register_internal_class_ex`, matching the browser crash root
cause.

---------

Co-authored-by: Jan Jakeš <jan@jakes.pro>
Co-authored-by: Chloe Pomegranate <chloehoughtonjenkins+git@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Francesco Bigiarini <francesco.bigiarini@gmail.com>
Co-authored-by: Wojtek Naruniec <wojtek@naruniec.me>
Co-authored-by: wpfuse <113634078+wp-fuse@users.noreply.github.com>
Co-authored-by: Ashish Kumar <ashfame@users.noreply.github.com>
Co-authored-by: Jon Surrell <sirreal@users.noreply.github.com>
Co-authored-by: John Blackbourn <john@johnblackbourn.com>
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
adamziel added a commit to WordPress/sqlite-database-integration that referenced this pull request May 27, 2026
## What?

Updates the GitHub Pages native parser demo to use PHP 8.5 instead of
the temporary PHP 8.3 pin:

- Playground links now use `php=8.5`.
- The Blueprint preferred PHP version is now 8.5.
- The page text says the manifest supports PHP 8.0 through 8.5.

## Why?

The PHP 8.3 pin was a workaround for missing Zend exports in the
Playground browser runtime. Once WordPress/wordpress-playground#3690 and
rebuilt web PHP.wasm artifacts ship, the browser runtime should support
the published `wp_mysql_parser` side modules across PHP 8.0-8.5.

## Dependency

Do not merge/publish this until the Playground web-runtime fix and
rebuilt artifacts are live, and
#417 passes against them.
adamziel added a commit to WordPress/sqlite-database-integration that referenced this pull request May 27, 2026
## What?

Adds a browser-runtime compatibility check for the `wp_mysql_parser`
WASM side modules and wires it into both WASM workflows:

- `wasm-spike.yml`
- `publish-wasm-extension-artifact.yml`

The check compares each side module's `env` function imports against the
matching Playground web PHP.wasm runtime exports. It runs for PHP 8.0
through 8.5 so the published manifest cannot claim browser support for a
PHP version that will crash during extension startup.

Also updates the native extension README/demo URL to use the live
`blueprint.json` location and documents PHP 8.0-8.5 browser-runtime
coverage instead of the temporary PHP 8.3 pin.

## Why?

The previous Node-based smoke test was insufficient: PHP 8.4 loaded in
the Node/CLI runtime but crashed in the browser runtime because the web
runtime did not export Zend symbols imported by the extension side
module.

This PR makes that class of failure visible in CI before publishing a
WASM manifest.

## Dependency

This depends on WordPress/wordpress-playground#3690 and updated
Playground web PHP.wasm artifacts. Current Playground web builds are
known to miss required exports for PHP 8.0, 8.1, 8.4, and 8.5; the new
CI check is expected to pass once those runtime exports ship.

## Testing

- `node --check
packages/php-ext-wp-mysql-parser/wasm-spike/check-playground-web-compat.mjs`
- `git diff --check`
- Verified locally with the Playground checkout:
  - PHP 8.3 currently passes.
- PHP 8.4 currently fails with missing `zend_declare_class_constant_ex`
and `zend_register_internal_class_ex`, matching the browser crash root
cause.

## Note

Replacement for #417, which was accidentally opened and merged against
`develop` instead of `trunk`.
bgrgicak pushed a commit that referenced this pull request May 28, 2026
## What?

Exports the Zend symbols needed by PHP 8.x side-module extensions from
the Playground JSPI main module:

- `_call_user_function_impl`
- `zend_declare_class_constant_ex`
- `zend_register_internal_class_ex`

Also rebuilds the affected web JSPI artifacts:

- `packages/php-wasm/web-builds/8-0/jspi`
- `packages/php-wasm/web-builds/8-1/jspi`
- `packages/php-wasm/web-builds/8-4/jspi`
- `packages/php-wasm/web-builds/8-5/jspi`

## Why?

The `wp_mysql_parser` extension built by
WordPress/sqlite-database-integration loaded in the Node/CLI runtime but
crashed the browser runtime for some PHP versions. The browser crash
happened before WordPress booted because the side module imported Zend
symbols that were not exported by the web PHP.wasm build.

Observed compatibility against the previous web builds:

- PHP 8.2 and 8.3 already exported all required symbols.
- PHP 8.0 and 8.1 missed `zend_declare_class_constant_ex`.
- PHP 8.4 missed `zend_declare_class_constant_ex` and
`zend_register_internal_class_ex`.
- PHP 8.5 missed those two plus `_call_user_function_impl`.

The Node builds already exposed these symbols, so this aligns web with
Node and allows external PHP extension manifests to support PHP 8.0
through 8.5 consistently.

## Testing

- Rebuilt web JSPI PHP artifacts for 8.0, 8.1, 8.4, and 8.5.
- Ran `git diff --check`.
- Verified the `wp_mysql_parser` side module imports are satisfied by
the matching web runtime exports for PHP 8.0 through 8.5 using a local
WebAssembly import/export comparison.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant