[wp-trac] [WordPress Trac] #60059: Warning / Error in wp-includes/canonical.php when $_GET['author'] is an array

WordPress Trac noreply at wordpress.org
Wed Dec 13 15:08:12 UTC 2023


#60059: Warning / Error in wp-includes/canonical.php when $_GET['author'] is an
array
--------------------------+------------------------------
 Reporter:  david.binda   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Canonical     |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by antonvlasenko):

 I don't have the time to test this now, but I have 2 concerns:

 1. I'm wondering why there is an array in the GET parameters. Did it work
 like that before? If not (i.e. is this a recent bug), what caused an array
 to appear in the GET parameters?

 > A fix seems to be to check if `is_string( $_GET['author'] )` before
 performing the `preg_match`.

 2. In the example you provided, `hello` seems to be a valid author name.
 If this bug was not caused by some recent change, perhaps it's worth
 considering getting the first element of the `author` array and using it
 as an author name (in case it's a string), as opposed to ignoring arrays.

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


More information about the wp-trac mailing list