Coding Standards: Use strict comparison for `normalize_whitespace()` checks when comparing revisions or autosaves.
Props dkarfa, itowhid06, TimothyBlynJacobs. Fixes #47965. Built from https://develop.svn.wordpress.org/trunk@47372 git-svn-id: http://core.svn.wordpress.org/trunk@47159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8b0a0c44aa
commit
3a333ef030
|
@ -245,7 +245,7 @@ $form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc
|
|||
// Detect if there exists an autosave newer than the post and if that autosave is different than the post.
|
||||
if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
|
||||
foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
|
||||
if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
|
||||
if ( normalize_whitespace( $autosave->$autosave_field ) !== normalize_whitespace( $post->$autosave_field ) ) {
|
||||
$notice = sprintf(
|
||||
/* translators: %s: URL to view the autosave. */
|
||||
__( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ),
|
||||
|
|
|
@ -1829,7 +1829,7 @@ function wp_create_post_autosave( $post_data ) {
|
|||
// If the new autosave has the same content as the post, delete the autosave.
|
||||
$autosave_is_different = false;
|
||||
foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
|
||||
if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
|
||||
if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) {
|
||||
$autosave_is_different = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -368,7 +368,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
|
|||
$autosave_is_different = false;
|
||||
|
||||
foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
|
||||
if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
|
||||
if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) {
|
||||
$autosave_is_different = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ function wp_save_post_revision( $post_id ) {
|
|||
$post_has_changed = false;
|
||||
|
||||
foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
|
||||
if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
|
||||
if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) {
|
||||
$post_has_changed = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-beta2-47371';
|
||||
$wp_version = '5.4-beta2-47372';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue