Fix: improve rejected pages config handling and nonce verification#1025
Draft
kraftbj wants to merge 3 commits into
Draft
Fix: improve rejected pages config handling and nonce verification#1025kraftbj wants to merge 3 commits into
kraftbj wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates how rejected page-type caching settings are persisted to the WP Super Cache config, improving config line matching and making nonce verification explicit within wp_cache_update_rejected_pages().
Changes:
- Updates
wp_cache_update_rejected_pages()to verify the nonce inline viawp_verify_nonce()and removes the$valid_nonceglobal dependency. - Enhances the config replacement regex so it matches both single-quoted and double-quoted
$wp_cache_pages[...]keys when updatingwp-cache-config.php.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e023a4f to
8b6daef
Compare
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.
Summary
Cherry-picks the still-relevant changes from closed PR #487 ("Improve wp-cache config functions"), adapted to the current codebase.
Originally proposed by @stodorovic in #487.
Changes to
wp_cache_update_rejected_pages():$wp_cache_pages['search']and$wp_cache_pages["search"]), preventing stale entries when the quote style in the config doesn't match the hardcoded pattern.$valid_nonceglobal with a directwp_verify_nonce()call, making the security check self-contained and explicit.$valid_nonceglobal declaration since it is no longer used.See #487