<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[58287] trunk: Coding Standards: Use strict comparison in `wp-admin/includes/ajax-actions.php`.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/58287">58287</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/58287","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-06-02 22:08:08 +0000 (Sun, 02 Jun 2024)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Coding Standards: Use strict comparison in `wp-admin/includes/ajax-actions.php`.
Follow-up to <a href="https://core.trac.wordpress.org/changeset/6213">[6213]</a>, <a href="https://core.trac.wordpress.org/changeset/8296">[8296]</a>, <a href="https://core.trac.wordpress.org/changeset/8720">[8720]</a>, <a href="https://core.trac.wordpress.org/changeset/9098">[9098]</a>, <a href="https://core.trac.wordpress.org/changeset/10204">[10204]</a>, <a href="https://core.trac.wordpress.org/changeset/10476">[10476]</a>, <a href="https://core.trac.wordpress.org/changeset/10912">[10912]</a>, <a href="https://core.trac.wordpress.org/changeset/11644">[11644]</a>, <a href="https://core.trac.wordpress.org/changeset/11749">[11749]</a>, <a href="https://core.trac.wordpress.org/changeset/12008">[12008]</a>, <a href="https://core.trac.wordpress.org/changeset/12036">[12036]</a>, <a href="https://core.trac.wordpress.org/changeset/13489">[13489]</a>, <a href="https://core.trac.wordpress.org/changeset/17354">[17354]</a>, <a href="https://core.trac.wordpress.org/changeset/17832">[17832]</a>,
<a href="https://core.trac.wordpress.org/changeset/18663">[18663]</a>, <a href="https://core.trac.wordpress.org/changeset/18796">[18796]</a>, <a href="https://core.trac.wordpress.org/changeset/18937">[18937]</a>, <a href="https://core.trac.wordpress.org/changeset/22843">[22843]</a>, <a href="https://core.trac.wordpress.org/changeset/28892">[28892]</a>, <a href="https://core.trac.wordpress.org/changeset/33356">[33356]</a>.
Props mujuonly, nihar007, aristath, poena, afercia, SergeyBiryukov.
See <a href="https://core.trac.wordpress.org/ticket/58988">#58988</a>, <a href="https://core.trac.wordpress.org/ticket/60700">#60700</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesajaxactionsphp">trunk/src/wp-admin/includes/ajax-actions.php</a></li>
<li><a href="#trunktestsphpunittestsajaxwpAjaxDeleteCommentphp">trunk/tests/phpunit/tests/ajax/wpAjaxDeleteComment.php</a></li>
<li><a href="#trunktestsphpunittestsajaxwpAjaxWpCompressionTestphp">trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesajaxactionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/ajax-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/ajax-actions.php 2024-06-02 22:00:26 UTC (rev 58286)
+++ trunk/src/wp-admin/includes/ajax-actions.php 2024-06-02 22:08:08 UTC (rev 58287)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -148,7 +148,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Require $term_search_min_chars chars for matching (default: 2)
</span><span class="cx" style="display: block; padding: 0 10px"> * ensure it's a non-negative, non-zero integer.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ( 0 == $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ( 0 === $term_search_min_chars ) || ( strlen( $search ) < $term_search_min_chars ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,10 +205,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $force_gzip = ( defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP );
</span><span class="cx" style="display: block; padding: 0 10px"> $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."';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 1 == $_GET['test'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( '1' === $_GET['test'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo $test_str;
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( 2 == $_GET['test'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( '2' === $_GET['test'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( -1 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -513,7 +513,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Only do the expensive stuff on a page-break, and about 1 other time per page.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 0 == $total % $per_page || 1 == mt_rand( 1, $per_page ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 === $total % $per_page || 1 === mt_rand( 1, $per_page ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $post_id = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> // What type of comment count are we looking for?
</span><span class="cx" style="display: block; padding: 0 10px"> $status = 'all';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -733,13 +733,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $status = wp_get_comment_status( $comment );
</span><span class="cx" style="display: block; padding: 0 10px"> $delta = -1;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $_POST['trash'] ) && 1 == $_POST['trash'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $_POST['trash'] ) && '1' === $_POST['trash'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'trash' === $status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( time() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $r = wp_trash_comment( $comment );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( isset( $_POST['untrash'] ) && 1 == $_POST['untrash'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( isset( $_POST['untrash'] ) && '1' === $_POST['untrash'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'trash' !== $status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( time() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -750,13 +750,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $_POST['comment_status'] ) || 'trash' !== $_POST['comment_status'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $delta = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( isset( $_POST['spam'] ) && 1 == $_POST['spam'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( isset( $_POST['spam'] ) && '1' === $_POST['spam'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'spam' === $status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( time() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $r = wp_spam_comment( $comment );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( isset( $_POST['unspam'] ) && 1 == $_POST['unspam'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( isset( $_POST['unspam'] ) && '1' === $_POST['unspam'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'spam' !== $status ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( time() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -767,7 +767,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $_POST['comment_status'] ) || 'spam' !== $_POST['comment_status'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $delta = 1;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- } elseif ( isset( $_POST['delete'] ) && 1 == $_POST['delete'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ } elseif ( isset( $_POST['delete'] ) && '1' === $_POST['delete'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $r = wp_delete_comment( $comment );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( -1 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1000,7 +1000,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $current = wp_get_comment_status( $comment );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( isset( $_POST['new'] ) && $_POST['new'] == $current ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( isset( $_POST['new'] ) && $_POST['new'] === $current ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( time() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1339,7 +1339,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['_wp_unfiltered_html_comment'] = '';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( wp_create_nonce( 'unfiltered-html-comment' ) !== $_POST['_wp_unfiltered_html_comment'] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> kses_remove_filters(); // Start with a clean slate.
</span><span class="cx" style="display: block; padding: 0 10px"> kses_init_filters(); // Set up the filters.
</span><span class="cx" style="display: block; padding: 0 10px"> remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1384,7 +1384,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $_POST['approve_parent'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $parent = get_comment( $comment_parent );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $parent && '0' === $parent->comment_approved && $parent->comment_post_ID == $comment_post_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $parent && '0' === $parent->comment_approved && (int) $parent->comment_post_ID === $comment_post_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( -1 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1482,8 +1482,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( $updated->get_error_message() );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
- $checkbox = ( isset( $_POST['checkbox'] ) && true == $_POST['checkbox'] ) ? 1 : 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $position = ( isset( $_POST['position'] ) && (int) $_POST['position'] ) ? (int) $_POST['position'] : '-1';
+ /*
+ * Checkbox is used to differentiate between the Edit Comments screen (1)
+ * and the Comments section on the Edit Post screen (0).
+ */
+ $checkbox = ( isset( $_POST['checkbox'] ) && '1' === $_POST['checkbox'] ) ? 1 : 0;
</ins><span class="cx" style="display: block; padding: 0 10px"> $wp_list_table = _get_list_table( $checkbox ? 'WP_Comments_List_Table' : 'WP_Post_Comments_List_Table', array( 'screen' => 'edit-comments' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $comment = get_comment( $comment_id );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1699,7 +1703,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( -1 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $meta->meta_value != $value || $meta->meta_key != $key ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $meta->meta_value !== $value || $meta->meta_key !== $key ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $u = update_metadata_by_mid( 'post', $mid, $value, $key );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $u ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems).
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1797,7 +1801,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( sanitize_key( $page ) != $page ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( sanitize_key( $page ) !== $page ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1828,7 +1832,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
</span><span class="cx" style="display: block; padding: 0 10px"> $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( sanitize_key( $page ) != $page ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( sanitize_key( $page ) !== $page ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1983,7 +1987,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $page = isset( $_POST['page'] ) ? $_POST['page'] : '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( sanitize_key( $page ) != $page ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( sanitize_key( $page ) !== $page ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2412,7 +2416,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $name == $id_base ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $name === $id_base ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_callable( $control['callback'] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> continue;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2742,7 +2746,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> check_ajax_referer( "set_post_thumbnail-$post_id" );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( '-1' == $thumbnail_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( -1 === $thumbnail_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( delete_post_thumbnail( $post_id ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $return = _wp_post_thumbnail_html( null, $post_id );
</span><span class="cx" style="display: block; padding: 0 10px"> $json ? wp_send_json_success( $return ) : wp_die( $return );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2926,7 +2930,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $active_lock = array_map( 'absint', explode( ':', $_POST['active_post_lock'] ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( get_current_user_id() != $active_lock[1] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( get_current_user_id() !== $active_lock[1] ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2951,7 +2955,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_ajax_dismiss_wp_pointer() {
</span><span class="cx" style="display: block; padding: 0 10px"> $pointer = $_POST['pointer'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( sanitize_key( $pointer ) != $pointer ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( sanitize_key( $pointer ) !== $pointer ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_die( 0 );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3323,7 +3327,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // If this attachment is unattached, attach it. Primarily a back compat thing.
</span><span class="cx" style="display: block; padding: 0 10px"> $insert_into_post_id = (int) $_POST['post_id'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 0 == $post->post_parent && $insert_into_post_id ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( 0 === $post->post_parent && $insert_into_post_id ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> wp_update_post(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'ID' => $id,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -4024,7 +4028,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $wp_site_icon = new WP_Site_Icon();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Skip creating a new attachment if the attachment is a Site Icon.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) == $context ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( get_post_meta( $attachment_id, '_wp_attachment_context', true ) === $context ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Delete the temporary cropped file, we don't need it.
</span><span class="cx" style="display: block; padding: 0 10px"> wp_delete_file( $cropped );
</span></span></pre></div>
<a id="trunktestsphpunittestsajaxwpAjaxDeleteCommentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/ajax/wpAjaxDeleteComment.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/ajax/wpAjaxDeleteComment.php 2024-06-02 22:00:26 UTC (rev 58286)
+++ trunk/tests/phpunit/tests/ajax/wpAjaxDeleteComment.php 2024-06-02 22:08:08 UTC (rev 58287)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,10 +76,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up a default request.
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['id'] = $comment->comment_ID;
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST[ $action ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST[ $action ] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_total'] = count( self::$comments );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST['_per_page'] = 100;
- $_POST['_page'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST['_per_page'] = '100';
+ $_POST['_page'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_url'] = admin_url( 'edit-comments.php' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,10 +135,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up the $_POST request.
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['id'] = $comment->comment_ID;
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST[ $action ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST[ $action ] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_total'] = count( self::$comments );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST['_per_page'] = 100;
- $_POST['_page'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST['_per_page'] = '100';
+ $_POST['_page'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_url'] = admin_url( 'edit-comments.php' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -167,10 +167,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up the $_POST request.
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['id'] = $comment->comment_ID;
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['_ajax_nonce'] = wp_create_nonce( uniqid() );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST[ $action ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST[ $action ] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_total'] = count( self::$comments );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST['_per_page'] = 100;
- $_POST['_page'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST['_per_page'] = '100';
+ $_POST['_page'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_url'] = admin_url( 'edit-comments.php' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -198,10 +198,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up the $_POST request.
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['id'] = 12346789;
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_12346789' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST[ $action ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST[ $action ] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_total'] = count( self::$comments );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST['_per_page'] = 100;
- $_POST['_page'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST['_per_page'] = '100';
+ $_POST['_page'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_url'] = admin_url( 'edit-comments.php' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request, look for a timestamp in the exception.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -235,10 +235,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up the $_POST request.
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['id'] = $comment->comment_ID;
</span><span class="cx" style="display: block; padding: 0 10px"> $_POST['_ajax_nonce'] = wp_create_nonce( 'delete-comment_' . $comment->comment_ID );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST[ $action ] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST[ $action ] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_total'] = count( self::$comments );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_POST['_per_page'] = 100;
- $_POST['_page'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_POST['_per_page'] = '100';
+ $_POST['_page'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px"> $_POST['_url'] = admin_url( 'edit-comments.php' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span></span></pre></div>
<a id="trunktestsphpunittestsajaxwpAjaxWpCompressionTestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php 2024-06-02 22:00:26 UTC (rev 58286)
+++ trunk/tests/phpunit/tests/ajax/wpAjaxWpCompressionTest.php 2024-06-02 22:08:08 UTC (rev 58287)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,7 +25,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->logout();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up a default request.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_GET['test'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_GET['test'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="cx" style="display: block; padding: 0 10px"> $this->expectException( 'WPAjaxDieStopException' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -42,7 +42,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_setRole( 'administrator' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up a default request.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_GET['test'] = 1;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_GET['test'] = '1';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="cx" style="display: block; padding: 0 10px"> try {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,7 +66,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_setRole( 'administrator' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up a default request.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_GET['test'] = 2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_GET['test'] = '2';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $_SERVER['HTTP_ACCEPT_ENCODING'] = 'deflate';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,7 +92,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_setRole( 'administrator' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up a default request.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_GET['test'] = 2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_GET['test'] = '2';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $_SERVER['HTTP_ACCEPT_ENCODING'] = 'gzip';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -114,7 +116,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->_setRole( 'administrator' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Set up a default request.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $_GET['test'] = 2;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $_GET['test'] = '2';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $_SERVER['HTTP_ACCEPT_ENCODING'] = 'unknown';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Make the request.
</span></span></pre>
</div>
</div>
</body>
</html>