Skip to content

Stop crash with PHP extension update - #2165

Closed
brandonpayton wants to merge 2 commits into
trunkfrom
stop-crash-with-php-ext-update
Closed

brandonpayton wants to merge 2 commits into
trunkfrom
stop-crash-with-php-ext-update

Conversation

@brandonpayton

@brandonpayton brandonpayton commented Mar 7, 2025 •

Copy link
Copy Markdown
Member

Motivation for the change, related issues

This PR includes a couple of commits that have appeared to resolve PHP-related crashes in a private Playground instance.

Fixes #2138

cc @bph

Implementation details

There are two commits:

  1. Upgrade Emscripten to v3.1.74
  2. Move DNS polyfills to a PHP extension and add missing constants

Testing Instructions (or ideally a Blueprint)

  • CI

Brandon Payton and others added 2 commits March 7, 2025 00:23
Note: This work is continued from a PR started under the WordPress GH
org.

There are a couple of reasons for this upgrade:

1. I am having trouble rebuilding php-wasm on my current system.
References to older ubuntu images and emscripten versions [has given me
trouble](#2038 (comment)).
2. We want [this Emscripten
fix](emscripten-core/emscripten#22932) from
@jeroenpf and @bgrgicak which was first included in Emscripten 3.1.73.

This PR:
- Bumps the ubuntu docker image version due to build errors related to
missing image. Referencing a newer ubuntu image seemed to fix the
"missing image" errors.
- Bumps Emscripten version
- Adjusts Playground-specific patches to Emscripten output since the
latest breaks that patching.

- CI (once we can run GH actions on A8C's GHE instance)

---------

Co-authored-by: Brandon Payton <brandon@happycode.net>
The original implementation of the DNS polyfill didn't register `DNS_*`
constants which are [expected to exist in
PHP](https://www.php.net/manual/en/network.constants.php#constant.dns-any).
To fix this this PR registered the required DNS constants.

The constants were already defined in the polyfill and now we register
them as PH constants using `REGISTER_LONG_CONSTANT`.

I didn't want to add more code to the `php_wasm.c` file that wasn't
directly related to PHP-wasm, so I moved the DNS polyfill code to an
extension.

- CI
@brandonpayton brandonpayton added [Type] Bug An existing feature does not function as intended [Package][@php-wasm] Web labels Mar 7, 2025
@brandonpayton brandonpayton self-assigned this Mar 7, 2025
@brandonpayton
brandonpayton requested a review from a team as a code owner March 7, 2025 05:34
@brandonpayton

Copy link
Copy Markdown
Member Author

Let's wait for CI tests to pass.

And before merging, I would like to temporarily allow merging discrete commits from PRs in order to keep the two commits separate on trunk. The change should only remain for a moment so we can merge.

@adamziel

adamziel commented Mar 26, 2025 •

Copy link
Copy Markdown
Collaborator

@brandonpayton I looked into the CI failures and they're all benign:

  • The PHP module and CI job is removed entirely in the private instance
  • The Spanish translation E2E failure was fixed by @bgrgicak the other day
  • The test-unit-asyncify failure is intermittent and would likely go away on re-run

We should be able to backport the related fixes here realtively easily, but we also don't have to hold up this PR because of those failures.

@adamziel

Copy link
Copy Markdown
Collaborator

Can this be closed now?

@brandonpayton

Copy link
Copy Markdown
Member Author

Can this be closed now?

Yes, it can, since we performed the big merge.

@brandonpayton
brandonpayton deleted the stop-crash-with-php-ext-update branch June 25, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package][@php-wasm] Web [Type] Bug An existing feature does not function as intended

Projects

No open projects
Status: Inbox

Development

Successfully merging this pull request may close these issues.

Out of memory on import with CORS issues.

3 participants