Skip to content

fix: ensure execution stops after redirects#786

Merged
kasparsd merged 2 commits intoWordPress:masterfrom
sjinks:fix/redirect
Feb 13, 2026
Merged

fix: ensure execution stops after redirects#786
kasparsd merged 2 commits intoWordPress:masterfrom
sjinks:fix/redirect

Conversation

@sjinks
Copy link
Contributor

@sjinks sjinks commented Feb 9, 2026

What?

This PR ensures that code execution stops after calling wp_safe_redirect() in the two-factor authentication validation functions. Without exit(), PHP continues executing code after sending redirect headers, which could lead to security vulnerabilities or unintended behavior.

Why?

This follows WordPress best practices and aligns with the existing function documentation that states "wp_safe_redirect() does not exit automatically, and should almost always be followed by a call to exit;."

How?

Add exit() after calls to wp_safe_redirect().

Testing Instructions

N/A :-(

Screenshots or screencast

N/A

Changelog Entry

Security - Ensure that code execution stops after calling wp_safe_redirect().

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sjinks <volodymyrkolesnykov@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@kasparsd kasparsd merged commit f062bab into WordPress:master Feb 13, 2026
29 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Two Factor project board Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants