diff --git src/wp-includes/query.php src/wp-includes/query.php
index a31bf87..f9bdd0f 100644
|
|
|
class WP_Query { |
| 1574 | 1574 | if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']); |
| 1575 | 1575 | |
| 1576 | 1576 | // Fairly insane upper bound for search string lengths. |
| 1577 | | if ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) |
| | 1577 | if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) { |
| 1578 | 1578 | $qv['s'] = ''; |
| | 1579 | } |
| 1579 | 1580 | |
| 1580 | 1581 | // Compat. Map subpost to attachment. |
| 1581 | 1582 | if ( '' != $qv['subpost'] ) |
diff --git tests/phpunit/tests/query/parseQuery.php tests/phpunit/tests/query/parseQuery.php
new file mode 100644
index 0000000..c4cb1dd
|
-
|
+
|
|
| | 1 | <?php |
| | 2 | |
| | 3 | /** |
| | 4 | * @group query |
| | 5 | */ |
| | 6 | class Tests_Query_ParseQuery extends WP_UnitTestCase { |
| | 7 | /** |
| | 8 | * @ticket 29736 |
| | 9 | */ |
| | 10 | public function test_parse_query_s_array() { |
| | 11 | $q = new WP_Query(); |
| | 12 | $q->parse_query( array( |
| | 13 | 's' => array( 'foo' ), |
| | 14 | ) ); |
| | 15 | |
| | 16 | $this->assertSame( '', $q->query_vars['s'] ); |
| | 17 | } |
| | 18 | |
| | 19 | public function test_parse_query_s_string() { |
| | 20 | $q = new WP_Query(); |
| | 21 | $q->parse_query( array( |
| | 22 | 's' => 'foo', |
| | 23 | ) ); |
| | 24 | |
| | 25 | $this->assertSame( 'foo', $q->query_vars['s'] ); |
| | 26 | } |
| | 27 | |
| | 28 | public function test_parse_query_s_float() { |
| | 29 | $q = new WP_Query(); |
| | 30 | $q->parse_query( array( |
| | 31 | 's' => 3.5, |
| | 32 | ) ); |
| | 33 | |
| | 34 | $this->assertSame( 3.5, $q->query_vars['s'] ); |
| | 35 | } |
| | 36 | |
| | 37 | public function test_parse_query_s_int() { |
| | 38 | $q = new WP_Query(); |
| | 39 | $q->parse_query( array( |
| | 40 | 's' => 3, |
| | 41 | ) ); |
| | 42 | |
| | 43 | $this->assertSame( 3, $q->query_vars['s'] ); |
| | 44 | } |
| | 45 | |
| | 46 | public function test_parse_query_s_bool() { |
| | 47 | $q = new WP_Query(); |
| | 48 | $q->parse_query( array( |
| | 49 | 's' => true, |
| | 50 | ) ); |
| | 51 | |
| | 52 | $this->assertSame( true, $q->query_vars['s'] ); |
| | 53 | } |
| | 54 | } |