| 1 | diff --git wp-includes/compat.php wp-includes/compat.php |
|---|
| 2 | index cb2a559..9d01933 100644 |
|---|
| 3 | --- wp-includes/compat.php |
|---|
| 4 | +++ wp-includes/compat.php |
|---|
| 5 | @@ -94,3 +94,15 @@ if ( !function_exists('json_decode') ) { |
|---|
| 6 | return is_array($data) ? array_map(__FUNCTION__, $data) : $data; |
|---|
| 7 | } |
|---|
| 8 | } |
|---|
| 9 | + |
|---|
| 10 | +if ( !function_exists( 'str_getcsv' ) ) { |
|---|
| 11 | + function str_getcsv( $input, $delimiter = ',', $enclosure = '"', $escape = "\\" ) { |
|---|
| 12 | + $fp = fopen( 'php://temp/', 'r+' ); |
|---|
| 13 | + fputs( $fp, $input ); |
|---|
| 14 | + rewind( $fp ); |
|---|
| 15 | + $data = fgetcsv( $fp, strlen( $input ), $delimiter, $enclosure ); |
|---|
| 16 | + fclose( $fp ); |
|---|
| 17 | + return $data; |
|---|
| 18 | + } |
|---|
| 19 | +} |
|---|
| 20 | + |
|---|
| 21 | diff --git wp-includes/functions.php wp-includes/functions.php |
|---|
| 22 | index 726eebb..dbc0d1f 100644 |
|---|
| 23 | --- wp-includes/functions.php |
|---|
| 24 | +++ wp-includes/functions.php |
|---|
| 25 | @@ -3399,19 +3399,6 @@ function get_file_data( $file, $default_headers, $context = '' ) { |
|---|
| 26 | } |
|---|
| 27 | |
|---|
| 28 | /** |
|---|
| 29 | - * Used internally to tidy up the search terms. |
|---|
| 30 | - * |
|---|
| 31 | - * @access private |
|---|
| 32 | - * @since 2.9.0 |
|---|
| 33 | - * |
|---|
| 34 | - * @param string $t |
|---|
| 35 | - * @return string |
|---|
| 36 | - */ |
|---|
| 37 | -function _search_terms_tidy($t) { |
|---|
| 38 | - return trim($t, "\"'\n\r "); |
|---|
| 39 | -} |
|---|
| 40 | - |
|---|
| 41 | -/** |
|---|
| 42 | * Returns true. |
|---|
| 43 | * |
|---|
| 44 | * Useful for returning true to filters easily. |
|---|
| 45 | diff --git wp-includes/query.php wp-includes/query.php |
|---|
| 46 | index 303a395..78ba230 100644 |
|---|
| 47 | --- wp-includes/query.php |
|---|
| 48 | +++ wp-includes/query.php |
|---|
| 49 | @@ -2180,8 +2180,7 @@ class WP_Query { |
|---|
| 50 | if ( !empty($q['sentence']) ) { |
|---|
| 51 | $q['search_terms'] = array($q['s']); |
|---|
| 52 | } else { |
|---|
| 53 | - preg_match_all('/".*?("|$)|((?<=[\r\n\t ",+])|^)[^\r\n\t ",+]+/', $q['s'], $matches); |
|---|
| 54 | - $q['search_terms'] = array_map('_search_terms_tidy', $matches[0]); |
|---|
| 55 | + $q['search_terms'] = array_filter( str_getcsv( $q['s'], ' ' ) ); |
|---|
| 56 | } |
|---|
| 57 | $n = !empty($q['exact']) ? '' : '%'; |
|---|
| 58 | $searchand = ''; |
|---|