Opened 12 years ago
Closed 12 years ago
#23425 closed defect (bug) (duplicate)
PHP warning in WP_Query::get_posts() when url includes ?page[]
Reported by: | dave1010 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 1.5.1 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
To reproduce:
- Install WordPress (I cloned from https://github.com/WordPress/WordPress, @ [23391])
- 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:
- {main}() /var/www/projects/wordpress/index.php:0
- require() /var/www/projects/wordpress/index.php:17
- wp() /var/www/projects/wordpress/wp-blog-header.php:14
- WP->main() /var/www/projects/wordpress/wp-includes/functions.php:779
- WP->query_posts() /var/www/projects/wordpress/wp-includes/class-wp.php:549
- WP_Query->query() /var/www/projects/wordpress/wp-includes/class-wp.php:485
- WP_Query->get_posts() /var/www/projects/wordpress/wp-includes/query.php:2972
- 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.
Change History (4)
Note: See
TracTickets for help on using
tickets.
Very similar, not sure if it's worth adding a new ticket. Adding
?s[]
to the URL gives an error in the same method:There may be other parameters that need sanitising too.