Repository navigation
fix: render query templates included during template_redirect, and run it after boot - #420
Merged
Merged
Conversation
Merged
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.
Closes #419. Thanks @Loubal70 for the thorough report and the patch it starts from.
Layer 1 — a Blade file included by PHP. Each
{type}_templatefilter (404_template…) hands back a loader that renders the view (the samemakeLoader()as WooCommerce templates), only whiletemplate_redirectruns. Outside it the path is untouched: the FrontendController needs the Blade path, and WordPress's own template loader still meets the raw-output guard. NewMakeTemplateIncludableUseCase(Application layer); the WordPress condition stays inWordPressTemplateHierarchyFilter::includableTemplate().Layer 2 —
template_redirectbefore the providers booted.wp()stays where it is;template_redirect, the robots / favicon / feed / trackback answers andpollora_loadedrun inApp::booted(), under the same WordPress error handling. Requests on WordPress's own entry points firepollora_loadedat once, as before.Trackbacks answered 500 (
wp-trackback.phprequired from a method loads WordPress again): the branch declaresglobal $wp, $wpdb, $posts.Tests
template_redirect), the filter registration, andrunWp()deferringtemplate_redirectuntil boot (fails on the old code). 1821 passed; PHPStan (macro call baselined like WooCommerce's), Rector (test excluded fromServerVariableToRequestFacadeRector, like its sibling), Pint clean.e2e-featuresfixture plugin answers?e2e-template-redirectlike WooCommerce's Review Order page; the spec checks the 404 renders with the layout, and that a trackback is answered and stored. Both fail on the old code, pass with the fix (pollora-test, Chromium).Checked by HTTP on pollora-test (apiary + WooCommerce 10.9)
Same 16 URLs with and without the fix — home, robots.txt, feeds, favicon, Pollora's 404,
/cms/(302 home),?p=1, shop, cart, account, search, product search redirect, posts, pages: identical. Only the reproduction changes (Blade source → rendered 404 page with header and footer), and the trackback (500 → 200, stored).