[wp-trac] [WordPress Trac] #21459: Cleanup switch_to_blog() and restore_current_blog()

WordPress Trac wp-trac at lists.automattic.com
Tue Aug 21 18:49:24 UTC 2012


#21459: Cleanup switch_to_blog() and restore_current_blog()
-------------------------+-----------------------
 Reporter:  ryan         |       Owner:  ryan
     Type:  enhancement  |      Status:  reopened
 Priority:  normal       |   Milestone:  3.5
Component:  Multisite    |     Version:  3.4.1
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |
-------------------------+-----------------------

Comment (by ryan):

 Replying to [comment:19 ryan]:
 > With 21459-no-switched.2.diff, the multisite unit tests exhibit some odd
 behavior. Tests_Post_Objects::test_get_post_array() fatal errors inside
 get_post() because WP_Post::filter() is returning false. The subsequent
 to_array() call is thus done on a non-object. Looking at $this in
 ::filter(), the post is js filtered. This is not expected. I suspect a
 cache problem.

 This is because I forgot to replace one instance of _wp_switched with
 ms_is_switched() in Tests_MS::test_switch_restore_blog().  The assertion
 failed resulting in the rest of the test not being run. When
 test_get_post_array() ran the cache was switched to the wrong blog. I
 think we need to rollback cache changes between tests.

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


More information about the wp-trac mailing list