[wp-trac] [WordPress Trac] #31246: Notice: Undefined offset: 0 in wp-includes/query.php on line 3877

WordPress Trac noreply at wordpress.org
Sat Feb 7 19:40:28 UTC 2015


#31246: Notice: Undefined offset: 0 in wp-includes/query.php on line 3877
----------------------------+--------------------
 Reporter:  Mediastuttgart  |       Owner:
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  4.1.1
Component:  Query           |     Version:  4.1
 Severity:  trivial         |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+--------------------
Changes (by boonebgorges):

 * keywords:  reporter-feedback =>
 * severity:  normal => trivial
 * milestone:  Awaiting Review => 4.1.1


Comment:

 Thanks for the link, Chouby.

 Your use of 'lang=all' is confusing `WP_Query` a bit. Earlier in
 `WP_Query::parse_query()`, `WP_Query::parse_tax_query()` is detecting that
 the 'lang=all' query looks like a taxonomy term query, and so sets the
 `is_tax` flag to `true`. Then, at the 'parse_query' hook, you are
 unsetting the 'lang' argument, so that when the tax query is reparsed in
 `get_posts()`, no 'lang' parameter is found. In other words: `WP_Query`
 first thinks that this is going to be a taxonomy query, but by unsetting
 'lang' later on, you're sorta pulling the rug out.

 The trick here (and the reason you're unsetting the query var) is that
 'all' is, of course, not actually a term in the 'language' taxonomy. I
 think your trick is OK, but you might consider running it a little sooner,
 maybe at 'parse_request', so that it would be sorted out before `WP_Query`
 has initialized.

 In any case, this is strictly speaking a regression in
 `get_queried_object()` - the new logic in 4.1 is slightly less forgiving
 in odd cases like this - so let's go ahead and fix it for 4.1.1.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31246#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list