[wp-trac] [WordPress Trac] #56558: Fatal Error caused by Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /www/example_website/public/wp-includes/class-wp-query.php:803

WordPress Trac noreply at wordpress.org
Tue Oct 10 11:20:43 UTC 2023


#56558: Fatal Error caused by Uncaught TypeError: trim(): Argument #1 ($string)
must be of type string, array given in /www/example_website/public/wp-
includes/class-wp-query.php:803
-------------------------------------------------+-------------------------
 Reporter:  rlmc                                 |       Owner:
                                                 |  SergeyBiryukov
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Query                                |     Version:  1.5
 Severity:  minor                                |  Resolution:  fixed
 Keywords:  needs-testing has-patch needs-       |     Focuses:
  testing-info                                   |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56815" 56815]:
 {{{
 #!CommitTicketReference repository="" revision="56815"
 Query: Ensure that the `page` parameter is scalar in
 `WP_Query::get_posts()`.

 The `page` query var only accepts a scalar value and passes the value
 through functions that assume a scalar value.

 Adding an extra guard condition does not affect its functionality but does
 avoid a PHP fatal error for `trim()` when a non-scalar value such as an
 array is passed.

 Follow-up to [2535], [53891].

 Props brookedot, rlmc, mukesh27, SergeyBiryukov.
 Fixes #56558.
 }}}

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


More information about the wp-trac mailing list