[wp-trac] [WordPress Trac] #12873: get_pages() may be run before init

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 6 15:21:37 UTC 2010


#12873: get_pages() may be run before init
--------------------------+-------------------------------------------------
 Reporter:  nacin         |       Owner:              
     Type:  defect (bug)  |      Status:  new         
 Priority:  normal        |   Milestone:  3.0         
Component:  Post Types    |     Version:  3.0         
 Severity:  normal        |    Keywords:  dev-feedback
--------------------------+-------------------------------------------------
 A friend is using a theme that blew up in 3.0-beta. The theme called
 get_pages() deep in some options factory before post types were
 initialized, which causes get_pages() to return false as no (hierarchical)
 post types were registered.

 The theme expected get_pages() to return an array. Our checks for a
 hierarchical post type and valid post status are both new, and they both
 would cause get_pages() to return false. Problem is, the results from
 get_pages() were immediately thrown into a foreach without casting it to
 an array (it always returned an array previously), which caused an
 E_WARNING and stopped redirection headers from being sent (i.e. login).

 I wanted to ticket this because there's a lot going on here. Simple back
 compat fix would be to return array() instead of false in get_pages(), but
 that doesn't help actually return the pages that would have been returned
 in 2.9.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12873>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list