Make WordPress Core

Ticket #47965: 47965.patch

File 47965.patch, 1.4 KB (added by dkarfa, 6 years ago)
  • wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

     
    210210                $prepared_post->ID = $post->ID;
    211211                $user_id           = get_current_user_id();
    212212
    213                 if ( ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) && $post->post_author == $user_id ) {
     213                if ( ( 'draft' === $post->post_status || 'auto-draft' === $post->post_status ) && $post->post_author === $user_id ) {
    214214                        // Draft posts for the same author: autosaving updates the post and does not create a revision.
    215215                        // Convert the post object to an array and add slashes, wp_update_post expects escaped array.
    216216                        $autosave_id = wp_update_post( wp_slash( (array) $prepared_post ), true );
     
    347347                        $autosave_is_different = false;
    348348
    349349                        foreach ( array_intersect( array_keys( $new_autosave ), array_keys( _wp_post_revision_fields( $post ) ) ) as $field ) {
    350                                 if ( normalize_whitespace( $new_autosave[ $field ] ) != normalize_whitespace( $post->$field ) ) {
     350                                if ( normalize_whitespace( $new_autosave[ $field ] ) !== normalize_whitespace( $post->$field ) ) {
    351351                                        $autosave_is_different = true;
    352352                                        break;
    353353                                }