Make WordPress Core

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#16444 closed defect (bug) (fixed)

add_user_to_blog() and remove_user_from_blog() can break the switch_to_blog() stack

Reported by: mdawaffe Owned by: markjaquith
Priority: normal Milestone: 3.1
Component: Users Version: 3.0.1
Severity: normal Keywords: has-patch dev-feedback
Cc: Focuses:

Description

Both add_user_to_blog() and remove_user_from_blog() call switch_to_blog() first thing. On encountering an error, however, they can return before calling restore_current_blog().

See #13903

Patch attached.

Attachments (1)

16444.diff​ (834 bytes ) - added by mdawaffe 16 years ago.

Download all attachments as: .zip

Change History (7)

#1 @markjaquith
16 years ago

  • Keywords dev-feedback added
  • Milestone Awaiting Review → 3.1
  • Owner set to markjaquith
  • Status new → accepted

Straightforward fix, for what could be a tricky bug to track down if encountered. Can I get some more people to weigh in?

#2 follow-up: @nacin
16 years ago

Looks good -- wondering if there are other places we're doing the same thing.

#3 @PeteMall
16 years ago

+1 from me as discussed in the IRC channel.

#4 in reply to: ↑ 2 @PeteMall
16 years ago

Replying to nacin:

Looks good -- wondering if there are other places we're doing the same thing.

Just browsed through all instances of switch_to_blog and doesn't look like we're doing this anywhere else.

Last edited 16 years ago by PeteMall (previous) (diff)

#5 @markjaquith
16 years ago

  • Resolution → fixed
  • Status accepted → closed

(In [17379]) restore_current_blog() in add_user_to_blog() and remove_user_from_blog() before early return, to avoid being stuck in a switched state. props mdawaffe. fixes #16444 for trunk.

#6 @markjaquith
16 years ago

(In [17380]) restore_current_blog() in add_user_to_blog() and remove_user_from_blog() before early return, to avoid being stuck in a switched state. props mdawaffe. fixes #16444 for trunk.

Note: See TracTickets for help on using tickets.