Changeset 57750
- Timestamp:
- 03/02/2024 01:36:02 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-comment-query.php
r57719 r57750 965 965 $this->sql_clauses['limits'] = $limits; 966 966 967 $this->request = "968 {$this->sql_clauses['select']}969 {$this->sql_clauses['from']}970 {$where}971 {$this->sql_clauses['groupby']}972 {$this->sql_clauses['orderby']}973 {$this->sql_clauses['limits']}974 ";967 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 968 $this->request = 969 "{$this->sql_clauses['select']} 970 {$this->sql_clauses['from']} 971 {$where} 972 {$this->sql_clauses['groupby']} 973 {$this->sql_clauses['orderby']} 974 {$this->sql_clauses['limits']}"; 975 975 976 976 if ( $this->query_vars['count'] ) { -
trunk/src/wp-includes/class-wp-network-query.php
r57719 r57750 482 482 $this->sql_clauses['limits'] = $limits; 483 483 484 $this->request = "485 {$this->sql_clauses['select']}486 {$this->sql_clauses['from']}487 {$where}488 {$this->sql_clauses['groupby']}489 {$this->sql_clauses['orderby']}490 {$this->sql_clauses['limits']}491 ";484 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 485 $this->request = 486 "{$this->sql_clauses['select']} 487 {$this->sql_clauses['from']} 488 {$where} 489 {$this->sql_clauses['groupby']} 490 {$this->sql_clauses['orderby']} 491 {$this->sql_clauses['limits']}"; 492 492 493 493 if ( $this->query_vars['count'] ) { -
trunk/src/wp-includes/class-wp-query.php
r57648 r57750 3105 3105 } 3106 3106 3107 $old_request = "3108 SELECT $found_rows $distinct $fields3109 FROM {$wpdb->posts} $join3110 WHERE 1=1 $where3111 $groupby3112 $orderby3113 $limits3114 ";3107 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 3108 $old_request = 3109 "SELECT $found_rows $distinct $fields 3110 FROM {$wpdb->posts} $join 3111 WHERE 1=1 $where 3112 $groupby 3113 $orderby 3114 $limits"; 3115 3115 3116 3116 $this->request = $old_request; … … 3308 3308 // First get the IDs and then fill in the objects. 3309 3309 3310 $this->request = "3311 SELECT $found_rows $distinct {$wpdb->posts}.ID3312 FROM {$wpdb->posts} $join3313 WHERE 1=1 $where3314 $groupby3315 $orderby3316 $limits3317 ";3310 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 3311 $this->request = 3312 "SELECT $found_rows $distinct {$wpdb->posts}.ID 3313 FROM {$wpdb->posts} $join 3314 WHERE 1=1 $where 3315 $groupby 3316 $orderby 3317 $limits"; 3318 3318 3319 3319 /** -
trunk/src/wp-includes/class-wp-site-query.php
r57648 r57750 696 696 $this->sql_clauses['limits'] = $limits; 697 697 698 $this->request = "699 {$this->sql_clauses['select']}700 {$this->sql_clauses['from']}701 {$where}702 {$this->sql_clauses['groupby']}703 {$this->sql_clauses['orderby']}704 {$this->sql_clauses['limits']}705 ";698 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 699 $this->request = 700 "{$this->sql_clauses['select']} 701 {$this->sql_clauses['from']} 702 {$where} 703 {$this->sql_clauses['groupby']} 704 {$this->sql_clauses['orderby']} 705 {$this->sql_clauses['limits']}"; 706 706 707 707 if ( $this->query_vars['count'] ) { -
trunk/src/wp-includes/class-wp-term-query.php
r57719 r57750 753 753 $this->sql_clauses['limits'] = $limits; 754 754 755 $this->request = "756 {$this->sql_clauses['select']}757 {$this->sql_clauses['from']}758 {$where}759 {$this->sql_clauses['orderby']}760 {$this->sql_clauses['limits']}761 ";755 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 756 $this->request = 757 "{$this->sql_clauses['select']} 758 {$this->sql_clauses['from']} 759 {$where} 760 {$this->sql_clauses['orderby']} 761 {$this->sql_clauses['limits']}"; 762 762 763 763 $this->terms = null; -
trunk/src/wp-includes/class-wp-user-query.php
r56543 r57750 819 819 820 820 if ( null === $this->results ) { 821 $this->request = "822 SELECT {$this->query_fields}823 {$this->query_from}824 {$this->query_where}825 {$this->query_orderby}826 {$this->query_limit}827 ";821 // Beginning of the string is on a new line to prevent leading whitespace. See https://core.trac.wordpress.org/ticket/56841. 822 $this->request = 823 "SELECT {$this->query_fields} 824 {$this->query_from} 825 {$this->query_where} 826 {$this->query_orderby} 827 {$this->query_limit}"; 828 828 $cache_value = false; 829 829 $cache_key = $this->generate_cache_key( $qv, $this->request ); -
trunk/tests/phpunit/tests/comment/query.php
r57653 r57750 5351 5351 $this->assertStringNotContainsString( ' comment_ID ', $wpdb->last_query ); 5352 5352 } 5353 5354 /** 5355 * @ticket 56841 5356 */ 5357 public function test_query_does_not_have_leading_whitespace() { 5358 self::factory()->comment->create( 5359 array( 5360 'comment_post_ID' => self::$post_id, 5361 'user_id' => 7, 5362 ) 5363 ); 5364 5365 $q = new WP_Comment_Query(); 5366 $q->query( 5367 array( 5368 'count' => true, 5369 'orderby' => 'none', 5370 ) 5371 ); 5372 5373 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 5374 } 5353 5375 } -
trunk/tests/phpunit/tests/multisite/wpNetworkQuery.php
r55745 r57750 609 609 return array( get_network( self::$network_ids['wordpress.org/'] ) ); 610 610 } 611 612 /** 613 * @ticket 56841 614 */ 615 public function test_wp_network_query_does_not_have_leading_whitespace() { 616 $q = new WP_Network_Query(); 617 $q->query( 618 array( 619 'fields' => 'all', 620 'number' => 3, 621 'order' => 'ASC', 622 'update_network_cache' => true, 623 ) 624 ); 625 626 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 627 } 611 628 } 612 629 -
trunk/tests/phpunit/tests/multisite/wpSiteQuery.php
r55745 r57750 1163 1163 return array( get_site( self::$site_ids['wordpress.org/'] ) ); 1164 1164 } 1165 1166 /** 1167 * @ticket 56841 1168 */ 1169 public function test_wp_site_query_does_not_have_leading_whitespace() { 1170 $q = new WP_Site_Query(); 1171 1172 $q->query( 1173 array( 1174 'fields' => 'ids', 1175 'network_id' => self::$network_ids['wordpress.org/'], 1176 'number' => 3, 1177 'order' => 'ASC', 1178 'update_site_cache' => true, 1179 'update_site_meta_cache' => true, 1180 ) 1181 ); 1182 1183 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 1184 } 1165 1185 } 1166 1186 -
trunk/tests/phpunit/tests/post/query.php
r57653 r57750 793 793 $this->assertSame( (bool) wp_using_ext_object_cache(), $filter->get_args()[0][0] ); 794 794 } 795 796 /** 797 * @ticket 56841 798 */ 799 public function test_query_does_not_have_leading_whitespace() { 800 add_filter( 'split_the_query', '__return_false' ); 801 802 $q = new WP_Query( 803 array( 804 'posts_per_page' => 501, 805 ) 806 ); 807 808 remove_filter( 'split_the_query', '__return_false' ); 809 810 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 811 } 812 813 /** 814 * @ticket 56841 815 */ 816 public function test_query_does_not_have_leading_whitespace_split_the_query() { 817 add_filter( 'split_the_query', '__return_true' ); 818 819 $q = new WP_Query( 820 array( 821 'posts_per_page' => 501, 822 ) 823 ); 824 825 remove_filter( 'split_the_query', '__return_true' ); 826 827 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 828 } 795 829 } -
trunk/tests/phpunit/tests/term/query.php
r56555 r57750 1124 1124 ); 1125 1125 } 1126 1127 /** 1128 * @ticket 56841 1129 */ 1130 public function test_query_does_not_have_leading_whitespace() { 1131 $q = new WP_Term_Query( 1132 array( 1133 'taxonomy' => 'wptests_tax', 1134 'hide_empty' => true, 1135 'fields' => 'ids', 1136 ) 1137 ); 1138 1139 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 1140 } 1126 1141 } -
trunk/tests/phpunit/tests/user/query.php
r57325 r57750 2379 2379 ); 2380 2380 } 2381 2382 /** 2383 * @ticket 56841 2384 */ 2385 public function test_query_does_not_have_leading_whitespace() { 2386 $q = new WP_User_Query( 2387 array( 2388 'number' => 2, 2389 ) 2390 ); 2391 2392 $this->assertSame( ltrim( $q->request ), $q->request, 'The query has leading whitespace' ); 2393 } 2381 2394 }
Note: See TracChangeset
for help on using the changeset viewer.