Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#6647 closed enhancement (fixed)

Internally, pass arrays instead of query strings to functions that use wp_parse_args()

Reported by: ryan Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Optimization Keywords: has-patch commit
Focuses: Cc:


Within core WP, we should pass arrays instead of query strings to functions that pass their args through wp_parse_args(). Arrays are faster, more secure, and avoid quoting bugs. See [7625] for an example conversion from a query string to an array.

Attachments (4)

6647.diff (2.6 KB) - added by DD32 7 years ago.
6647.2.diff (13.5 KB) - added by Denis-de-Bernardy 6 years ago.
more_array_args.6647.diff (3.7 KB) - added by filosofo 6 years ago.
more_array_args.6647.2.diff (5.9 KB) - added by hakre 6 years ago.

Download all attachments as: .zip

Change History (19)

@DD327 years ago

comment:1 @DD327 years ago

attachment 6647.diff added.

Just some that i came accross while creating a patch for #6772, The changes in wp-includes/media.php have been duplicated in a patch on that ticket. I'll refresh this patch if need be when that tickets fixed.

comment:2 @ryan7 years ago

(In [7894]) Use array calling style. Props DD32. see #6647

comment:3 @ryan7 years ago

(In [7911]) Use array calling style. see #6647

comment:4 @Denis-de-Bernardy6 years ago

  • Component changed from General to Optimization


comment:5 @Denis-de-Bernardy6 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.9 to Future Release
  • Type changed from defect (bug) to enhancement

there are still a few in the default theme. do we want them fixed?

comment:6 @Denis-de-Bernardy6 years ago

get_bookmarks(), get_categories(), get_terms(), wp_get_object_terms() each have a few more

@Denis-de-Bernardy6 years ago

comment:7 @Denis-de-Bernardy6 years ago

  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone changed from Future Release to 2.9

untested patch attached

comment:8 @Denis-de-Bernardy6 years ago

wp() might also need to be looked into:


comment:9 @ryan6 years ago

  • Keywords early added
  • Milestone changed from 2.9 to 3.0

comment:10 @ryan6 years ago

  • Keywords has-patch needs-testing early removed

Leaving open to catch any further ones.

comment:12 @filosofo6 years ago

Here are a few more that turned up in a grep.

comment:13 @hakre6 years ago

  • Keywords has-patch added
  • Version set to 2.9

I jumped in as well and found some more. Merged that together with filosofo's findings.

comment:14 @Denis-de-Bernardy6 years ago

  • Keywords commit added

patch still applies clean. could we get this checked in?

comment:15 @westi6 years ago

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

(In [12657]) Switch to passing arrays instead of query strings to functions. Fixes #6647 props filosofo and hakre.

Note: See TracTickets for help on using tickets.