Make WordPress Core


Ignore:
Timestamp:
11/25/2026 07:33:37 PM (14 hours ago)
Author:
lancewillett
Message:

Revisions: Bound comparisons when rendering large diffs.

Skip word highlighting for very long lines. Display removed lines followed by added lines when matching a changed block would exceed the line or pair limit. Sites can adjust the limits through wp_text_diff().

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/16136

Props iverok, justjack1, arkaprabhachowdhury, adamsilverstein, dmsnell, josephscott, mukesh27.
Fixes #66095.
See #48973.

File:
1 edited

Legend:

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

    r65788 r65790  
    34123412         *
    34133413         * @since 2.6.0
     3414         * @since 7.3.0 Added the `$max_word_diff_line_length`, `$max_changed_lines`,
     3415         *              and `$max_changed_line_pairs` arguments.
    34143416         *
    34153417         * @see wp_parse_args() Used to change defaults to user defined settings.
    … …  
    34223424         *     Associative array of options to pass to WP_Text_Diff_Renderer_Table().
    34233425         *
    3424          *     @type string $title           Titles the diff in a manner compatible
    3425          *                                   with the output. Default empty.
    3426          *     @type string $title_left      Change the HTML to the left of the title.
    3427          *                                   Default empty.
    3428          *     @type string $title_right     Change the HTML to the right of the title.
    3429          *                                   Default empty.
    3430          *     @type bool   $show_split_view True for split view (two columns), false for
    3431          *                                   un-split view (single column). Default true.
     3426         *     @type string $title                      Titles the diff in a manner compatible
     3427         *                                              with the output. Default empty.
     3428         *     @type string $title_left                 Change the HTML to the left of the title.
     3429         *                                              Default empty.
     3430         *     @type string $title_right                Change the HTML to the right of the title.
     3431         *                                              Default empty.
     3432         *     @type bool   $show_split_view            True for split view (two columns), false for
     3433         *                                              un-split view (single column). Default true.
     3434         *     @type int    $max_word_diff_line_length  Changed lines longer than this many bytes get
     3435         *                                              no word-level highlighting. Default 10000.
     3436         *     @type int    $max_changed_lines          A changed block with more old and new lines
     3437         *                                              than this shows removed lines, then added
     3438         *                                              lines. Default 5000.
     3439         *     @type int    $max_changed_line_pairs     A changed block with more old-by-new line
     3440         *                                              pairs than this shows removed lines, then
     3441         *                                              added lines. Default 250000.
    34323442         * }
    34333443         * @return string Empty string if strings are equivalent or HTML with differences.
Note: See TracChangeset for help on using the changeset viewer.