[wp-trac] [WordPress Trac] #20143: Array query args on a paginated archive page creates PHP Warning, breaks page.

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 29 17:48:23 UTC 2012


#20143: Array query args on a paginated archive page creates PHP Warning, breaks
page.
--------------------------+-----------------------------
 Reporter:  ericlewis     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Having query args that are elements of an array breaks in
 redirect_canonical.

 To reproduce:
 1. Create enough posts in an install to warrant pagination of posts
 2. Go to second page and add an array element query arg eg.
 http://www.siteurl.com/page/2/?foo[bar]=true

 I'm getting this PHP warning:


 {{{
 Warning: rawurlencode() expects parameter 1 to be string, array given in
 /Users/ericlewis/Sites/wp-trunk/wp-includes/canonical.php on line 283

 Warning: Cannot modify header information - headers already sent by
 (output started at /Users/ericlewis/Sites/wp-trunk/wp-
 includes/canonical.php:283) in /Users/ericlewis/Sites/wp-trunk/wp-
 includes/pluggable.php on line 864
 }}}

 This stems from the fact that in redirect_canonical, the query args are
 parsed into an array via parse_str(), and then rawurlencode() is applied
 to each element of that array. In this case, that means rawurlencode is
 applied to an array (foo), which causes the issue.

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


More information about the wp-trac mailing list