Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Networking broken when extra PHP extensions are enabled #1045

Merged

Conversation

adamziel
Copy link
Collaborator

The recent removal of custom WordPress
patches
broke the networking feature when the extra PHP extensions are enabled. It removed the default networking tranports via the http_api_transports filter, but it did not account for WordPress trying to use the Fetch and Fsockopen transports anyway whenever their ::test() method returns true – which it does when the OpenSSL extension is available.

This PR uses the reflections API to force-replace the Requests::$transports array with one containing exclusively the Fetch transport.

Open Playground, enable PHP extensions and networking, go to WP Admin > Plugins > Add, confirm the list of plugins is visible

CC @bgrgicak @annezazu

The recent [removal of custom WordPress
patches](#1004)
broke the networking feature when the extra PHP extensions are enabled.
It removed the default networking tranports via the http_api_transports
filter, but it did not account for WordPress trying to use the Fetch and
Fsockopen transports anyway whenever their `::test()` method returns
true – which it does when the OpenSSL extension is available.

This PR uses the reflections API to force-replace the
Requests::$transports array with one containing exclusively the Fetch
transport.

Open Playground, enable PHP extensions and networking, go to WP Admin >
Plugins > Add, confirm the list of plugins is visible

CC @bgrgicak @annezazu
@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Feature] PHP.wasm [Aspect] Networking labels Feb 22, 2024
Copy link
Collaborator

@bgrgicak bgrgicak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described.

I took the time to start a Wiki with Blueprint examples and added this as the first one.

Here is a local link for testing this PR http://localhost:5400/website-server/?blueprint-url=https://gist.githubusercontent.com/bgrgicak/0784d4d67d0b57657957c9d7c85cdea0/raw/blueprint.json

@adamziel adamziel merged commit b81666c into trunk Feb 23, 2024
5 checks passed
@adamziel adamziel deleted the fix-networking-when-the-kitchen-sink-bundle-is-enabled branch February 23, 2024 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Networking [Feature] PHP.wasm [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants