Make WordPress Core


Ignore:
Timestamp:
08/19/2023 11:20:25 PM (3 years ago)
Author:
isabel_brison
Message:

Editor: update npm packages with critical bug fixes for 6.3.1.

Includes fixes for footnotes and editor styles related crashes, as well as a cut and paste-related crash.

Props ramonopoly.
See #59151.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/footnotes.php

    r56332 r56419  
    3535        $footnotes = json_decode( $footnotes, true );
    3636
    37         if ( count( $footnotes ) === 0 ) {
     37        if ( ! is_array( $footnotes ) || count( $footnotes ) === 0 ) {
    3838                return '';
    3939        }
    … …  
    9999                if ( $footnotes ) {
    100100                        // Can't use update_post_meta() because it doesn't allow revisions.
    101                         update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
     101                        update_metadata( 'post', $revision_id, 'footnotes', wp_slash( $footnotes ) );
    102102                }
    103103        }
    … …  
    155155                        if ( $footnotes ) {
    156156                                // Can't use update_post_meta() because it doesn't allow revisions.
    157                                 update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', $footnotes );
     157                                update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', wp_slash( $footnotes ) );
    158158                        }
    159159                }
    … …  
    161161}
    162162
    163 foreach ( array( 'post', 'page' ) as $post_type ) {
    164         add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' );
    165 }
     163add_action( 'rest_after_insert_post', 'wp_add_footnotes_revisions_to_post_meta' );
     164add_action( 'rest_after_insert_page', 'wp_add_footnotes_revisions_to_post_meta' );
    166165
    167166/**
    … …  
    177176
    178177        if ( $footnotes ) {
    179                 update_post_meta( $post_id, 'footnotes', $footnotes );
     178                update_post_meta( $post_id, 'footnotes', wp_slash( $footnotes ) );
    180179        } else {
    181180                delete_post_meta( $post_id, 'footnotes' );
    … …  
    244243        }
    245244
    246         update_post_meta( $id, 'footnotes', $body['meta']['footnotes'] );
     245        update_post_meta( $id, 'footnotes', wp_slash( $body['meta']['footnotes'] ) );
    247246}
    248247// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L391C1-L391C1.
Note: See TracChangeset for help on using the changeset viewer.