Ticket #33372: 33372_5.diff
File 33372_5.diff, 1.5 KB (added by , 8 years ago) |
---|
-
src/wp-includes/query.php
1595 1595 if ( ! empty($qv['robots']) ) 1596 1596 $this->is_robots = true; 1597 1597 1598 $qv['p'] = absint($qv['p']); 1598 if ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) { 1599 $qv['p'] = 0; 1600 $qv['error'] = '404'; 1601 } else { 1602 $qv['p'] = intval( $qv['p'] ); 1603 } 1604 1599 1605 $qv['page_id'] = absint($qv['page_id']); 1600 1606 $qv['year'] = absint($qv['year']); 1601 1607 $qv['monthnum'] = absint($qv['monthnum']); -
tests/phpunit/tests/query/parseQuery.php
51 51 52 52 $this->assertSame( true, $q->query_vars['s'] ); 53 53 } 54 55 /** 56 * @ticket 33372 57 */ 58 public function test_parse_query_p_negative_int() { 59 $q = new WP_Query(); 60 $q->parse_query( array( 61 'p' => -3, 62 ) ); 63 64 $this->assertSame( '404', $q->query_vars['error'] ); 65 } 66 67 /** 68 * @ticket 33372 69 */ 70 public function test_parse_query_p_array() { 71 $q = new WP_Query(); 72 $q->parse_query( array( 73 'p' => array(), 74 ) ); 75 76 $this->assertSame( '404', $q->query_vars['error'] ); 77 } 78 79 /** 80 * @ticket 33372 81 */ 82 public function test_parse_query_p_object() { 83 $q = new WP_Query(); 84 $q->parse_query( array( 85 'p' => new stdClass(), 86 ) ); 87 88 $this->assertSame( '404', $q->query_vars['error'] ); 89 } 90 54 91 }