fix: correct the nonce argument in the version switch AJAX handlers (3.10.2) - #506
Merged
imantsk merged 2 commits intoSep 1, 2026
Merged
Conversation
check_ajax_referer() reads its second argument as the name of the request key holding the nonce, but both handlers passed the nonce value itself. WordPress looked for $_REQUEST['<nonce value>'], found nothing, fell through to _ajax_nonce and _wpnonce which the front end does not send, and ended up verifying an empty string. Both handlers therefore rejected every request with a 403, including requests carrying a valid nonce, so Switch Version and Refresh Available Versions did nothing. Passing the key name lets a valid nonce through while an invalid one is still rejected. (cherry picked from commit 9394b91)
ramiy
approved these changes
Sep 1, 2026
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.
Retarget of #494 onto the release branch. Same commit, cherry-picked, so it applies without dragging in unrelated
core-betachanges to the test files.Switching or rolling back the plugin version does nothing. Picking a version and clicking Switch Version shows "An error occurred."; Refresh Available Versions resets its own label without any message at all. Reproduced on a live site as well as locally.
check_ajax_referer( $action, $query_arg )treats$query_argas the name of the request key to read the nonce from. Both handlers passed the nonce's value there instead, so WordPress looked for$_REQUEST['<the nonce value>'], fell through to_ajax_nonceand_wpnonce— neither of which the front end sends — and verified an empty string. Every request was rejected, valid nonce or not.Promotion_Base::dismiss_promotion_ajax_handler()already does this correctly withcheck_ajax_referer( self::AJAX_ACTION, 'nonce' ), which is the form used here.Testing
Against
admin-ajax.phpas a logged-in admin:403200 success403403403403403The switch case was exercised with an empty
target_version, so the request passes the nonce and capability checks and stops at validation, proving the gate opens without installing anything. Also driven through the real UI on a clean WordPress 7.1 install with the plugin installed from a built zip: the dropdown populates with all 62 versions and both buttons respond. phpcs clean, suite passes.Note this sits behind Settings → Debug → Enable version change, which is off by default, so only people who switched it on will have hit it.