Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#33245 closed defect (bug) (invalid)

4.3 - Invalid arguments passed to wp_validate_redirect within wp_safe_redirect()

Reported by: paultgoodchild's profile paultgoodchild Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: General Keywords:
Focuses: Cc:

Description

File: pluggable.php
Line: 1284
Function: wp_safe_redirect()

Current/Bug:

$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );

Fix:

$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url() ), $status );

Reasoning:
The $status is being passed to the new 'wp_safe_redirect_fallback' filter as the 3rd parameter (which doesn't exist). It should be passed to wp_validate_redirect() as its 2nd parameter

Change History (3)

#1 @obenland
10 years ago

Hi Paul, thanks for bring this up!

Hook callbacks, no matter whether they are action or filter callbacks, will get all arguments passed on to them that are defined after the name of the hook (in this case wp_safe_redirect_fallback). So the only arguments it gets is admin_url() and $status.

From the function documentation of apply_filters():

 * @param string $tag   The name of the filter hook.
 * @param mixed  $value The value on which the filters hooked to `$tag` are applied on.
 * @param mixed  $var   Additional variables passed to the functions hooked to `$tag`.
 * @return mixed The filtered value after all hooked functions are applied to it.

#2 @paultgoodchild
10 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Ahh yes, my bad. I see exactly what you mean!

#3 @ocean90
10 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.