Make WordPress Core

Changeset 47372


Ignore:
Timestamp:
02/25/2020 07:33:22 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison for normalize_whitespace() checks when comparing revisions or autosaves.

Props dkarfa, itowhid06, TimothyBlynJacobs.
Fixes #47965.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r47222 r47372  
    246246if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
    247247    foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
    248         if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
     248        if ( normalize_whitespace( $autosave->$autosave_field ) !== normalize_whitespace( $post->$autosave_field ) ) {
    249249            $notice = sprintf(
    250250                /* translators: %s: URL to view the autosave. */
  • trunk/src/wp-admin/includes/post.php

    r47222 r47372  
    18301830        $autosave_is_different = false;
    18311831        foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
    1832             if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
     1832            if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) {
    18331833                $autosave_is_different = true;
    18341834                break;
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

    r47122 r47372  
    369369
    370370            foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
    371                 if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
     371                if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) {
    372372                    $autosave_is_different = true;
    373373                    break;
  • trunk/src/wp-includes/revision.php

    r47219 r47372  
    163163
    164164            foreach ( array_keys( _wp_post_revision_fields( $post ) ) as $field ) {
    165                 if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
     165                if ( normalize_whitespace( $post->$field ) !== normalize_whitespace( $last_revision->$field ) ) {
    166166                    $post_has_changed = true;
    167167                    break;
Note: See TracChangeset for help on using the changeset viewer.