[wp-trac] [WordPress Trac] #22125: Prevent stomping $wp_the_query by accident

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 7 22:21:54 UTC 2012


#22125: Prevent stomping $wp_the_query by accident
-----------------------------+-------------------------
 Reporter:  scribu           |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Query
  Version:                   |   Severity:  normal
 Keywords:                   |
-----------------------------+-------------------------
 We have this in wp-settings.php:

 {{{
 $wp_query =& $wp_the_query;
 }}}

 This was necessary in PHP4, but in PHP5 it makes it easy to overwrite
 $wp_the_query by accident:

 {{{
 // tra la la, some template file

 $wp_query = new WP_Query( ... );
 }}}

 and in general it obscures the fact that `$wp_the_query` should remain
 frozen.

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


More information about the wp-trac mailing list