You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes difficult to determine logic bugs occur when switch_to_blog() is called without a subsequent restoration. It would be worth flagging to the user that restore_current_blog() should be called after (if not already) after switch_to_blog().
This should be reported:
function switch_blog() {
$id = get_current_blog_id();
if ( $id === 2 ) {
return;
}
switch_to_blog( 2 );
}
This should not be reported:
function switch_blog() {
$id = get_current_blog_id();
if ( $id === 2 ) {
return;
}
switch_to_blog( 2 );
restore_current_blog();
}
Describe the solution you'd like
Sometimes difficult to determine logic bugs occur when
switch_to_blog()
is called without a subsequent restoration. It would be worth flagging to the user thatrestore_current_blog()
should be called after (if not already) afterswitch_to_blog()
.This should be reported:
This should not be reported:
Additional context (optional)
Automattic/VIP-Coding-Standards#651
The text was updated successfully, but these errors were encountered: