[wp-trac] [WordPress Trac] #23425: PHP warning in WP_Query::get_posts() when url includes ?page[]

WordPress Trac noreply at wordpress.org
Fri Feb 8 15:49:22 UTC 2013


#23425: PHP warning in WP_Query::get_posts() when url includes ?page[]
-----------------------------+--------------------------
 Reporter:  dave1010         |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Query
  Version:  trunk            |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 To reproduce:

 1. Install WordPress (I cloned from
 https://github.com/WordPress/WordPress, @ [23391])
 2. Go to `http://example.com/?page[]`

 Stack trace:

     Warning:  trim() expects parameter 1 to be string, array given in
 /var/www/projects/wordpress/wp-includes/query.php on line 2024
     Stack trace:
       1. {main}() /var/www/projects/wordpress/index.php:0
       2. require() /var/www/projects/wordpress/index.php:17
       3. wp() /var/www/projects/wordpress/wp-blog-header.php:14
       4. WP->main() /var/www/projects/wordpress/wp-
 includes/functions.php:779
       5. WP->query_posts() /var/www/projects/wordpress/wp-includes/class-
 wp.php:549
       6. WP_Query->query() /var/www/projects/wordpress/wp-includes/class-
 wp.php:485
       7. WP_Query->get_posts() /var/www/projects/wordpress/wp-
 includes/query.php:2972
       8. trim() /var/www/projects/wordpress/wp-includes/query.php:2024


 Looks like the query var "page" needs sanitizing / casting to string,
 either with the `trim()` on line 2024 or before.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23425>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list