Skip to content

Exit after wp_safe_redirect() #123

Description

@jrfnl

As per the documentation of the wp_safe_redirect() function:

Note: wp_safe_redirect() does not exit automatically, and should almost always be followed by a call to exit;:

wp_safe_redirect( $url );
exit;

Exiting can also be selectively manipulated by using wp_safe_redirect() as a conditional in conjunction with the ‘wp_redirect’ and ‘wp_redirect_location’ filters:

if ( wp_safe_redirect( $url ) ) {
    exit;
}

This plugin currently contains 12 calls to wp_safe_redirect() which are not followed by a call to exit.

As I'm not sure whether this was done so by design, I haven't changed this, but am opening this issue instead.


Details of the calls found without exit (click to open)
FILE: src\admin-debug-info.php                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 83 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\development-mode.php                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 64 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\domain-dropdown.php                                                                                                   
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 77 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\feature-toggler.php                                                                                                   
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 85 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\inline-script.php                                                                                                     
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 88 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\plugin-toggler.php                                                                                                    
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 226 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                      
     |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                          
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\plugin-version-control.php                                                                                            
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 95 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\post-types.php                                                                                                        
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 117 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                      
     |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                          
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\schema.php                                                                                                            
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 121 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                      
     |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                          
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\support-session.php                                                                                                   
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 116 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                      
     |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                          
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\wordpress-plugin-features.php                                                                                         
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 108 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                      
     |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                          
------------------------------------------------------------------------------------------------------------------------        
                                                                                                                                
                                                                                                                                
FILE: src\xml-sitemaps.php                                                                                                      
------------------------------------------------------------------------------------------------------------------------        
FOUND 1 ERROR AFFECTING 1 LINE                                                                                                  
------------------------------------------------------------------------------------------------------------------------        
 93 | ERROR | `wp_safe_redirect()` should almost always be followed by a call to `exit;`.                                       
    |       | (WordPressVIPMinimum.Security.ExitAfterRedirect.NoExit)                                                           
------------------------------------------------------------------------------------------------------------------------        

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions