Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#20528 closed defect (bug) (fixed)

$parsed_url['query'] doesn't always exist

Reported by: johnjamesjacoby Owned by: duck_
Milestone: 3.4 Priority: normal
Severity: normal Version: 3.4
Component: Canonical Keywords: has-patch commit
Focuses: Cc:


_remove_qs_args_if_not_in_url() assumes there is always an array item 'query' returned by parse_url.

Wrapping it in an empty check will suppress the notice and silently return the $query_string

Attachments (2)

20528.patch (717 bytes) - added by johnjamesjacoby 4 years ago.
20528.diff (885 bytes) - added by duck_ 4 years ago.

Download all attachments as: .zip

Change History (6)

#1 @nacin
4 years ago

  • Milestone changed from Awaiting Review to 3.4
  • Version set to 3.4

4 years ago

#2 @duck_
4 years ago

There should also be an else branch so that all of the query args to check get removed if the URL doesn't have a query string, see 20528.diff.

#3 @nacin
4 years ago

  • Keywords commit added

Yes, looks good. Could use some direct unit tests.

#4 @duck_
4 years ago

  • Owner set to duck_
  • Resolution set to fixed
  • Status changed from new to closed

In [20669]:

Prevent a notice: don't attempt to parse the query string if it doesn't exist. Props johnjamesjacoby. Fixes #20528.

Note: See TracTickets for help on using tickets.