Changeset 63016
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r62956 r63016 286 286 * 287 287 * @since 3.4.0 288 * @since 7.1.0 The search term is now sanitized, and a missing, non-string, 289 * or empty term results in a `0` response instead of an empty array. 290 * 291 * @return never 288 292 */ 289 293 function wp_ajax_autocomplete_user() { … … 298 302 299 303 $return = array(); 304 305 // Obtain the search term, and short-circuit missing/invalid search term. 306 if ( ! isset( $_REQUEST['term'] ) || ! is_string( $_REQUEST['term'] ) ) { 307 wp_die( 0 ); 308 } 309 /* 310 * Asterisks are trimmed since wildcards are appended below. Without this, a 311 * term consisting only of asterisks would result in an empty search that 312 * matches all users. 313 */ 314 $term = trim( sanitize_text_field( wp_unslash( $_REQUEST['term'] ) ), '*' ); 315 if ( '' === $term ) { 316 wp_die( 0 ); 317 } 300 318 301 319 /* … … 343 361 array( 344 362 'blog_id' => false, 345 'search' => '*' . $ _REQUEST['term']. '*',363 'search' => '*' . $term . '*', 346 364 'include' => $include_blog_users, 347 365 'exclude' => $exclude_blog_users,
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)