[wp-trac] [WordPress Trac] #14418: Introduce restore_original_blog()

WordPress Trac wp-trac at lists.automattic.com
Mon Mar 12 08:52:19 UTC 2012


#14418: Introduce restore_original_blog()
-----------------------------------------------+---------------------------
 Reporter:  nacin                              |       Owner:
     Type:  enhancement                        |      Status:  new
 Priority:  lowest                             |   Milestone:  Future
Component:  Multisite                          |  Release
 Severity:  normal                             |     Version:
 Keywords:  has-patch needs-testing 3.2-early  |  Resolution:
-----------------------------------------------+---------------------------

Comment (by westi):

 I am bit wary of this function because of the following scenario:

  1. Request runs on blog 23
  2. Code A calls switch_to_blog( 123 );
  3. Code A calls function b();
  4. function b() calls function c();
  5. function c() calls switch_to_blog( 456 ); and switch_to_blog( 768 );
 and restore_original_blog();
  6. core returns to function b();
  7. Code returns to Code A which thinks it is switched to blog 123 but is
 now running on blog 23 and does nasty things to the blog.

 This could be something which never happens in testing but does happen
 when the code is used or modified over time and would be hard to prevent
 in code.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14418#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list