WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#3928 closed task (blessed) (fixed)

add_query_arg() without assignment in upload.php

Reported by: markjaquith Owned by: mdawaffe
Milestone: 2.2 Priority: low
Severity: normal Version: 2.2
Component: Administration Keywords:
Focuses: Cc:

Description

trunk/wp-admin/upload.php:88-94

echo "<ul id='upload-menu'>\n";
foreach ( $wp_upload_tabs as $t => $tab_array ) { // We've already done the current_user_can check
	$href = add_query_arg( array('tab' => $t, 'ID' => '', 'action' => '', 'paged' => '') );
	if ( isset($tab_array[4]) && is_array($tab_array[4]) )
		add_query_arg( $tab_array[4], $href );
	$_href = attribute_escape( $href);
	$page_links = '';

That second add_query_arg() call isn't assigning to anything, so it doesn't do anything.

I have no symptoms to report at this time... just noticed that it looked wrong.

Change History (4)

comment:1 DD327 years ago

Someone can correct me if i'm wrong, But by the look of it, that function call:

add_query_arg( $tab_array[4], $href );

is used to append $tab_array[4] onto the end of $href.

comment:2 markjaquith7 years ago

It is... but then nothing is done with it. It isn't assigned to anything. Someone baked a cake and left it in the oven.

comment:3 joetan7 years ago

The fix to this should simply be changing line 92 from

add_query_arg( $tab_array[4], $href );

to

$href = add_query_arg( $tab_array[4], $href );

This fix would greatly help with some plugin's I'm working on. Thanks!

comment:4 ryan7 years ago

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

(In [5126]) Add missing lvalue. Props markjaquith and joetan. fixes #3928

Note: See TracTickets for help on using tickets.