[wp-trac] [WordPress Trac] #45594: Action 'switch_blog' duplicated $new_blog param

WordPress Trac noreply at wordpress.org
Wed Dec 12 12:46:51 UTC 2018


#45594: Action 'switch_blog' duplicated $new_blog param
--------------------------------+-----------------------------
 Reporter:  ChriCo              |      Owner:  (none)
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:  5.0
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 The action 'switch_blog' which can be found in wp-includes/ms-blogs.php
 L1660 has two times {{{$new_blog}}} injected, while the Doc Block says:

 {{{#!php
 <?php
 * @param int $new_blog New blog ID.
 * @param int $new_blog Blog ID.
 }}}

 This is maybe - in this context - correct, since in L1651 we're checking
 for {{{if ( $new_blog == $blog_id )}}} before doing the action.

 But regarding correctness, it should be {{{$new_blog}}} and
 {{{$prev_blog_id}}} (as declared after the if-statement) as param and in
 docBlocks (for generation of documentation).

 My patch...

 1. renames {{{$blog_id}}} into {{{$prev_blog_id}}}.
 2. updates the docBlock for the action 'switch_blog'.
 3. update third param in 'switch_blog' to {{{$prev_blog_id}}}.
 4. removes the not required {{{$prev_blog_id = $blog_id}}}.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45594>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list