Add sniff to check that WP is killed after wp_(safe_)redirect
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by reading the existing WordPress.VIP.RestrictedFunctions.wp_redirect_wp_redirect sniff and the referenced wp_redirect() and wp_safe_redirect() documentation. Implement coverage for calls followed by die(), exit, or wp_die(), including the conditional example; done means both redirect functions are checked without duplicating the existing error message.
Written by the indexing model from the issue text.
Description
Add sniff to check that any call to wp_redirect() and wp_safe_redirect() is followed by a call to die(), exit or wp_die().
The call is allowed to be conditional.
wp_redirect( $url );
exit;
if ( wp_redirect( $url ) ) {
exit;
}
Refs:
- https://developer.wordpress.org/reference/functions/wp_redirect/
- https://developer.wordpress.org/reference/functions/wp_safe_redirect/
Reminder: if/when this sniff is pulled, the error message for WordPress.VIP.RestrictedFunctions.wp_redirect_wp_redirect can be shortened to avoid message duplication.
Suggestions for additional functions which should be checked for this welcome!
- Dominant language
- PHP
- Stars
- 2.8k
- Forks
- 521
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from WordPress/WordPress-Coding-Standards
-
Component: Core Focus: DB Type: Bug
Difficulty 2/5 Half a day Newbie friendliness 68/100
WordPress/WordPress-Coding-Standards#2720 · 1 comment ·
-
Component: Extra Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
WordPress/WordPress-Coding-Standards#2516 · 3 comments ·
-
WordPress.Security.EscapeOutput: Wiki misses hint about lower case entry for customEscapingFunctions Open
Difficulty 1/5 Under an hour Newbie friendliness 62/100
WordPress/WordPress-Coding-Standards#2508 · 3 comments ·
-
Status: Good first issue Status: Help wanted Type: Documentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
WordPress/WordPress-Coding-Standards#1722 · 15 comments ·
-
Component: Helpers Priority: Low Type: Bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in WordPress/WordPress-Coding-Standards
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getgrav/grav-plugin-api#45 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RSS-Bridge/rss-bridge#5098 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
phingofficial/phing#2025 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
silverstripe/developer-docs#911 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100