WordPress.org

Make WordPress Core

Ticket #36718: 36718.patch

File 36718.patch, 1.5 KB (added by vortfu, 5 years ago)
  • src/wp-includes/query.php

     
    15931593                $qv['monthnum'] = absint($qv['monthnum']);
    15941594                $qv['day'] = absint($qv['day']);
    15951595                $qv['w'] = absint($qv['w']);
    1596                 $qv['m'] = preg_replace( '|[^0-9]|', '', $qv['m'] );
     1596                $qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : '';
    15971597                $qv['paged'] = absint($qv['paged']);
    15981598                $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
    15991599                $qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers
  • tests/phpunit/tests/query/date.php

     
    258258                $this->assertEquals( $expected_dates, wp_list_pluck( $posts, 'post_date' ) );
    259259        }
    260260
     261        /**
     262         * @ticket
     263         */
     264
     265        public function test_simple_m_with_array_expecting_results() {
     266                $expected = $this->_get_query_result( );
     267                $posts    = $this->_get_query_result( array(
     268                        'm' => array( '1234' ), // ignored
     269                ) );
     270
     271                $this->assertEquals( $expected, $posts );
     272        }
     273
    261274        public function test_simple_monthnum_expecting_results() {
    262275                $posts = $this->_get_query_result( array(
    263276                        'monthnum' => 5,