Repository navigation
Conversation
release: v13.43.2
chore: release 13.43.3
chore: release 13.43.4
chore: release 13.44.0
… requests get their hooks
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.
Fixes #708
WordPress answers a REST request (
/wp-json/…,/?rest_route=…) fromparse_request, insidewp(), and exits.runWp()calledwp()fromWordPressServiceProvider::boot(), before the application's and the theme's providers had booted, so everything they add inboot()was missing from REST requests, block editor saves included.wp()now runs in theApp::booted()callback #419 added, just beforetemplate_redirect, still before routing. WordPress's own order insidewp()is unchanged.Changes
src/WordPress/QueryTrait.php:wp()moved into theApp::booted()callback, under the samewithWordPressErrorHandling().tests/Unit/WordPress/DeferredTemplateRedirectTest.php: nothing runs before every provider has booted, thenwp,template_redirect,pollora_loaded. Fails without the fix.CHANGELOG.md: anUnreleased›Fixedentry, with the behaviour change for providers reading the main query inboot().How to test
The unit tests run in the console, where
runWp()is skipped, so the real check is over HTTP. On a Pollora site:boot():Filter::add('probe/hooked', static fn (): bool => true);['booted' => app()->isBooted(), 'hooked' => apply_filters('probe/hooked', false)](full snippet in the issue).GET /wp-json/probe/v1/state:false/falsebefore,true/trueafter.save_posthooked from thatboot(): called only after.Checked on a site with WordPress 6.9, WooCommerce, Polylang and Yoast (FrankenPHP): REST index and routes, home, product, 404, search,
robots.txt, feed, sitemap,wp-admin,admin-ajax.phpandwp-cron.phpanswer the same before and after. Details in the issue.QA
On PHP 8.4, the CI's extensions:
PHPStan reports one error, in
Foundation/Providers/ArtisanServiceProvider.php:43(Illuminate\Console\Application::add()deprecated since Symfony 7.4). That file is untouched; the error comes from the dependencies resolved today.