Changeset 58287
- Timestamp:
- 06/02/2024 10:08:08 PM (8 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/ajax-actions.php
r58105 r58287 149 149 * ensure it's a non-negative, non-zero integer. 150 150 */ 151 if ( ( 0 == $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) {151 if ( ( 0 === $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) { 152 152 wp_die(); 153 153 } … … 206 206 $test_str = '"wpCompressionTest Lorem ipsum dolor sit amet consectetuer mollis sapien urna ut a. Eu nonummy condimentum fringilla tempor pretium platea vel nibh netus Maecenas. Hac molestie amet justo quis pellentesque est ultrices interdum nibh Morbi. Cras mattis pretium Phasellus ante ipsum ipsum ut sociis Suspendisse Lorem. Ante et non molestie. Porta urna Vestibulum egestas id congue nibh eu risus gravida sit. Ac augue auctor Ut et non a elit massa id sodales. Elit eu Nulla at nibh adipiscing mattis lacus mauris at tempus. Netus nibh quis suscipit nec feugiat eget sed lorem et urna. Pellentesque lacus at ut massa consectetuer ligula ut auctor semper Pellentesque. Ut metus massa nibh quam Curabitur molestie nec mauris congue. Volutpat molestie elit justo facilisis neque ac risus Ut nascetur tristique. Vitae sit lorem tellus et quis Phasellus lacus tincidunt nunc Fusce. Pharetra wisi Suspendisse mus sagittis libero lacinia Integer consequat ac Phasellus. Et urna ac cursus tortor aliquam Aliquam amet tellus volutpat Vestibulum. Justo interdum condimentum In augue congue tellus sollicitudin Quisque quis nibh."'; 207 207 208 if ( 1== $_GET['test'] ) {208 if ( '1' === $_GET['test'] ) { 209 209 echo $test_str; 210 210 wp_die(); 211 } elseif ( 2== $_GET['test'] ) {211 } elseif ( '2' === $_GET['test'] ) { 212 212 if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) { 213 213 wp_die( -1 ); … … 514 514 515 515 // Only do the expensive stuff on a page-break, and about 1 other time per page. 516 if ( 0 == $total % $per_page || 1== mt_rand( 1, $per_page ) ) {516 if ( 0 === $total % $per_page || 1 === mt_rand( 1, $per_page ) ) { 517 517 $post_id = 0; 518 518 // What type of comment count are we looking for? … … 734 734 $delta = -1; 735 735 736 if ( isset( $_POST['trash'] ) && 1== $_POST['trash'] ) {736 if ( isset( $_POST['trash'] ) && '1' === $_POST['trash'] ) { 737 737 if ( 'trash' === $status ) { 738 738 wp_die( time() ); … … 740 740 741 741 $r = wp_trash_comment( $comment ); 742 } elseif ( isset( $_POST['untrash'] ) && 1== $_POST['untrash'] ) {742 } elseif ( isset( $_POST['untrash'] ) && '1' === $_POST['untrash'] ) { 743 743 if ( 'trash' !== $status ) { 744 744 wp_die( time() ); … … 751 751 $delta = 1; 752 752 } 753 } elseif ( isset( $_POST['spam'] ) && 1== $_POST['spam'] ) {753 } elseif ( isset( $_POST['spam'] ) && '1' === $_POST['spam'] ) { 754 754 if ( 'spam' === $status ) { 755 755 wp_die( time() ); … … 757 757 758 758 $r = wp_spam_comment( $comment ); 759 } elseif ( isset( $_POST['unspam'] ) && 1== $_POST['unspam'] ) {759 } elseif ( isset( $_POST['unspam'] ) && '1' === $_POST['unspam'] ) { 760 760 if ( 'spam' !== $status ) { 761 761 wp_die( time() ); … … 768 768 $delta = 1; 769 769 } 770 } elseif ( isset( $_POST['delete'] ) && 1== $_POST['delete'] ) {770 } elseif ( isset( $_POST['delete'] ) && '1' === $_POST['delete'] ) { 771 771 $r = wp_delete_comment( $comment ); 772 772 } else { … … 1001 1001 $current = wp_get_comment_status( $comment ); 1002 1002 1003 if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) {1003 if ( isset( $_POST['new'] ) && $_POST['new'] === $current ) { 1004 1004 wp_die( time() ); 1005 1005 } … … 1340 1340 } 1341 1341 1342 if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {1342 if ( wp_create_nonce( 'unfiltered-html-comment' ) !== $_POST['_wp_unfiltered_html_comment'] ) { 1343 1343 kses_remove_filters(); // Start with a clean slate. 1344 1344 kses_init_filters(); // Set up the filters. … … 1385 1385 $parent = get_comment( $comment_parent ); 1386 1386 1387 if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID== $comment_post_id ) {1387 if ( $parent && '0' === $parent->comment_approved && (int) $parent->comment_post_ID === $comment_post_id ) { 1388 1388 if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) { 1389 1389 wp_die( -1 ); … … 1483 1483 } 1484 1484 1485 $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; 1486 $checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0; 1485 $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1'; 1486 /* 1487 * Checkbox is used to differentiate between the Edit Comments screen (1) 1488 * and the Comments section on the Edit Post screen (0). 1489 */ 1490 $checkbox = ( isset( $_POST['checkbox'] ) && '1' === $_POST['checkbox'] ) ? 1 : 0; 1487 1491 $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); 1488 1492 … … 1700 1704 } 1701 1705 1702 if ( $meta->meta_value != $value || $meta->meta_key != $key ) {1706 if ( $meta->meta_value !== $value || $meta->meta_key !== $key ) { 1703 1707 $u = update_metadata_by_mid( 'post', $mid, $value, $key ); 1704 1708 if ( ! $u ) { … … 1798 1802 $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; 1799 1803 1800 if ( sanitize_key( $page ) != $page ) {1804 if ( sanitize_key( $page ) !== $page ) { 1801 1805 wp_die( 0 ); 1802 1806 } … … 1829 1833 $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; 1830 1834 1831 if ( sanitize_key( $page ) != $page ) {1835 if ( sanitize_key( $page ) !== $page ) { 1832 1836 wp_die( 0 ); 1833 1837 } … … 1984 1988 $page = isset( $_POST['page'] ) ? $_POST['page'] : ''; 1985 1989 1986 if ( sanitize_key( $page ) != $page ) {1990 if ( sanitize_key( $page ) !== $page ) { 1987 1991 wp_die( 0 ); 1988 1992 } … … 2413 2417 foreach ( (array) $wp_registered_widget_updates as $name => $control ) { 2414 2418 2415 if ( $name == $id_base ) {2419 if ( $name === $id_base ) { 2416 2420 if ( ! is_callable( $control['callback'] ) ) { 2417 2421 continue; … … 2743 2747 } 2744 2748 2745 if ( '-1'== $thumbnail_id ) {2749 if ( -1 === $thumbnail_id ) { 2746 2750 if ( delete_post_thumbnail( $post_id ) ) { 2747 2751 $return = _wp_post_thumbnail_html( null, $post_id ); … … 2927 2931 $active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) ); 2928 2932 2929 if ( get_current_user_id() != $active_lock[1] ) {2933 if ( get_current_user_id() !== $active_lock[1] ) { 2930 2934 wp_die( 0 ); 2931 2935 } … … 2952 2956 $pointer = $_POST['pointer']; 2953 2957 2954 if ( sanitize_key( $pointer ) != $pointer ) {2958 if ( sanitize_key( $pointer ) !== $pointer ) { 2955 2959 wp_die( 0 ); 2956 2960 } … … 3324 3328 $insert_into_post_id = (int) $_POST['post_id']; 3325 3329 3326 if ( 0 == $post->post_parent && $insert_into_post_id ) {3330 if ( 0 === $post->post_parent && $insert_into_post_id ) { 3327 3331 wp_update_post( 3328 3332 array( … … 4025 4029 4026 4030 // Skip creating a new attachment if the attachment is a Site Icon. 4027 if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) {4031 if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) === $context ) { 4028 4032 4029 4033 // Delete the temporary cropped file, we don't need it. -
trunk/tests/phpunit/tests/ajax/wpAjaxDeleteComment.php
r54722 r58287 77 77 $_POST['id'] = $comment->comment_ID; 78 78 $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); 79 $_POST[ $action ] = 1;80 $_POST['_total'] = count( self::$comments ); 81 $_POST['_per_page'] = 100;82 $_POST['_page'] = 1;79 $_POST[ $action ] = '1'; 80 $_POST['_total'] = count( self::$comments ); 81 $_POST['_per_page'] = '100'; 82 $_POST['_page'] = '1'; 83 83 $_POST['_url'] = admin_url( 'edit-comments.php' ); 84 84 … … 136 136 $_POST['id'] = $comment->comment_ID; 137 137 $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); 138 $_POST[ $action ] = 1;139 $_POST['_total'] = count( self::$comments ); 140 $_POST['_per_page'] = 100;141 $_POST['_page'] = 1;138 $_POST[ $action ] = '1'; 139 $_POST['_total'] = count( self::$comments ); 140 $_POST['_per_page'] = '100'; 141 $_POST['_page'] = '1'; 142 142 $_POST['_url'] = admin_url( 'edit-comments.php' ); 143 143 … … 168 168 $_POST['id'] = $comment->comment_ID; 169 169 $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() ); 170 $_POST[ $action ] = 1;171 $_POST['_total'] = count( self::$comments ); 172 $_POST['_per_page'] = 100;173 $_POST['_page'] = 1;170 $_POST[ $action ] = '1'; 171 $_POST['_total'] = count( self::$comments ); 172 $_POST['_per_page'] = '100'; 173 $_POST['_page'] = '1'; 174 174 $_POST['_url'] = admin_url( 'edit-comments.php' ); 175 175 … … 199 199 $_POST['id'] = 12346789; 200 200 $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_12346789' ); 201 $_POST[ $action ] = 1;202 $_POST['_total'] = count( self::$comments ); 203 $_POST['_per_page'] = 100;204 $_POST['_page'] = 1;201 $_POST[ $action ] = '1'; 202 $_POST['_total'] = count( self::$comments ); 203 $_POST['_per_page'] = '100'; 204 $_POST['_page'] = '1'; 205 205 $_POST['_url'] = admin_url( 'edit-comments.php' ); 206 206 … … 236 236 $_POST['id'] = $comment->comment_ID; 237 237 $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID ); 238 $_POST[ $action ] = 1;239 $_POST['_total'] = count( self::$comments ); 240 $_POST['_per_page'] = 100;241 $_POST['_page'] = 1;238 $_POST[ $action ] = '1'; 239 $_POST['_total'] = count( self::$comments ); 240 $_POST['_per_page'] = '100'; 241 $_POST['_page'] = '1'; 242 242 $_POST['_url'] = admin_url( 'edit-comments.php' ); 243 243 -
trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php
r54722 r58287 26 26 27 27 // Set up a default request. 28 $_GET['test'] = 1;28 $_GET['test'] = '1'; 29 29 30 30 // Make the request. … … 43 43 44 44 // Set up a default request. 45 $_GET['test'] = 1;45 $_GET['test'] = '1'; 46 46 47 47 // Make the request. … … 67 67 68 68 // Set up a default request. 69 $_GET['test'] = 2; 69 $_GET['test'] = '2'; 70 70 71 $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate'; 71 72 … … 92 93 93 94 // Set up a default request. 94 $_GET['test'] = 2; 95 $_GET['test'] = '2'; 96 95 97 $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip'; 96 98 … … 115 117 116 118 // Set up a default request. 117 $_GET['test'] = 2; 119 $_GET['test'] = '2'; 120 118 121 $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown'; 119 122
Note: See TracChangeset
for help on using the changeset viewer.