[wp-trac] [WordPress Trac] #46000: non empty post object in case of error 404

WordPress Trac noreply at wordpress.org
Wed Jan 16 09:21:09 UTC 2019


#46000: non empty post object in case of error 404
---------------------------+-----------------------------
 Reporter:  petersplugins  |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  5.0.3
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 In case of an 404 error the Posts Object is not empty if permalink setting
 is something like
 {{{
 /blog/%postname%/
 }}}

 The attached plugin can be used to debug this issue.

 == How to reproduce the problem

 **Step 1**

 Change permalink setting to
 {{{
 /%postname%/
 }}}

 Request a non existing URL like example.com/non-existent.

 Result: the Posts Object is empty

 **Step 2**

 Change permalink setting to
 {{{
 /blog/%year%/%monthnum%/%postname%/
 }}}

 Request a non existing URL like example.com/non-existent.

 Result: the Posts Object is empty

 **Step 3**

 Change permalink setting to
 {{{
 /blog/%postname%/
 }}}

 Request a non existing URL like example.com/**blog**/non-existent.

 Result: the Posts Object is empty

 **Step 4**

 permalink setting is still
 {{{
 /blog/%postname%/
 }}}

 Request a non existing URL like example.com/non-existent.

 Result: **the Posts Objec is NOT empty**

 == Impact ==

 Plugins that use **the_posts** filter may produce wrong results.

 I've tested it with 5.0.3 but I'm pretty sure, previous versions are
 affected also.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46000>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list