[wp-trac] [WordPress Trac] #19412: Changeset 18995 can lead to Notice: Undefined index: wp_the_query

WordPress Trac wp-trac at lists.automattic.com
Fri Dec 2 20:05:57 UTC 2011


#19412: Changeset 18995 can lead to Notice: Undefined index: wp_the_query
-----------------------------+------------------
 Reporter:  bobbingwide      |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  3.3
Component:  Query            |     Version:  3.3
 Severity:  normal           |  Resolution:
 Keywords:  has-patch close  |
-----------------------------+------------------
Changes (by nacin):

 * keywords:  has-patch => has-patch close


Comment:

 Per a discussion in IRC earlier today, I think it would be better to just
 close this as wontfix.

  * If $wp_the_query is an object, then everything will work.

  * If $wp_the_query is not yet set, then nothing will break (correct me if
 I'm wrong) and a notice will result.

 At this point, if you're using it wrong, you get a notice. Seems fine to
 me. The alternatives are A) return silently if $wp_the_query isn't set, or
 B) issue a _doing_it_wrong() notice. B) is kind of redundant since a
 notice is already being returned, and A) hides from developers that there
 is a problem.

 Has this been seen outside of Yoast's plugin? I imagine he'll be quick to
 fix it.

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


More information about the wp-trac mailing list