[wp-trac] [WordPress Trac] #55955: Setting a 'NOT EXISTS' tax query in 'pre_get_posts' action triggers a fatal error in wp-includes/canonical.php

WordPress Trac noreply at wordpress.org
Thu Nov 10 03:00:13 UTC 2022


#55955: Setting a 'NOT EXISTS' tax query in 'pre_get_posts' action triggers a fatal
error in wp-includes/canonical.php
-------------------------------------------------+-------------------------
 Reporter:  codesdnc                             |       Owner:
                                                 |  peterwilsoncc
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.1.1
Component:  Canonical                            |     Version:  6.0
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  php8 has-patch has-unit-tests        |     Focuses:
  commit                                         |
-------------------------------------------------+-------------------------
Changes (by peterwilsoncc):

 * owner:  (none) => peterwilsoncc
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54785" 54785]:
 {{{
 #!CommitTicketReference repository="" revision="54785"
 Canonical: Protect against error for term not exists queries.

 Prevent term `NOT EXISTS` queries causing `redirect_canonical()` to throw
 a fatal error in PHP 8 and above, or a warning in earlier versions.

 This ensures the `tax_query`'s `terms` property both exists and is
 countable before attempting to count it.

 Props codesdnc, SergeyBiryukov, kadamwhite, costdev, miguelaxcar.
 Fixes #55955.
 }}}

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


More information about the wp-trac mailing list