Skip to content

Commit 479596a

Browse files
committed
Plugins: Remove slashes from search terms and use urldecode() in non-URL contexts.
Fixes #35712. git-svn-id: https://develop.svn.wordpress.org/trunk@36560 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 548a180 commit 479596a

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/wp-admin/includes/class-wp-plugins-list-table.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function prepare_items() {
268268
}
269269

270270
/**
271-
* @global string $s
271+
* @global string $s URL encoded search term.
272272
*
273273
* @param array $plugin
274274
* @return bool
@@ -277,7 +277,7 @@ public function _search_callback( $plugin ) {
277277
global $s;
278278

279279
foreach ( $plugin as $value ) {
280-
if ( is_string( $value ) && false !== stripos( strip_tags( $value ), $s ) ) {
280+
if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) {
281281
return true;
282282
}
283283
}
@@ -316,7 +316,7 @@ public function no_items() {
316316
global $plugins;
317317

318318
if ( ! empty( $_REQUEST['s'] ) ) {
319-
$s = esc_html( $_REQUEST['s'] );
319+
$s = esc_html( wp_unslash( $_REQUEST['s'] ) );
320320

321321
printf( __( 'No plugins found for “%s”.' ), $s );
322322

src/wp-admin/plugins.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$action = $wp_list_table->current_action();
1919

2020
$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
21-
$s = isset($_REQUEST['s']) ? urlencode($_REQUEST['s']) : '';
21+
$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
2222

2323
// Clean up request URI from temporary args for screen options/paging uri's to work as expected.
2424
$_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
@@ -486,7 +486,7 @@
486486

487487
if ( strlen( $s ) ) {
488488
/* translators: %s: search keywords */
489-
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
489+
printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( urldecode( $s ) ) );
490490
}
491491
?>
492492
</h1>

0 commit comments

Comments
 (0)