[wp-trac] [WordPress Trac] #29660: Functions in wp_includes/query.php assume non-null return value from get_queried_object

WordPress Trac noreply at wordpress.org
Tue Apr 14 13:02:17 UTC 2015


#29660: Functions in wp_includes/query.php assume non-null return value from
get_queried_object
-------------------------------+------------------------------
 Reporter:  yellyc             |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Query              |     Version:  4.0
 Severity:  normal             |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by darkskipper):

 Hello,
 I've seen this on my site too.

 Steps to reproduce:

   1. Install WordPress 4.1.1.
   2. All plug-ins are deactivated.
   3. Default theme "TwentyFifteen" in use.
   4. Set permalinks to custom structure "/%post_id%/".
   5. In the reading settings, set front page to display the "sample page"
 static page. Leave "posts page" unset.
   6. Log out.
   7. Make sure PHP error logging is enabled.
   8. In the browser, enter a URL for the comments feed of a non-existent
 post,
      e.g. "http://my.site.net/non/existent/place/feed/".
   9. Examine the PHP error log.

   * Expected: no extra log messages.
   * Actual: log messages, such as "Notice: Trying to get property of non-
 object: {path}/wp-includes/query.php(4349)". I got six similar messages in
 my case.
   * Impact: Such URLs can be requested by web crawlers and other "bots".
 This will result in the accumulation of log messages. These messages are
 the result of core WP code behaviour and not theme nor plug-in code.

 I do not believe that these messages reflect a developer error on my part,
 therefore I hope this adds fuel to the argument for adding a patch to
 check the return value of `WP_Query::get_queried_object()` at line 4345 in
 `query.php`.

 Regards, Kevin Machin.

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


More information about the wp-trac mailing list