[wp-trac] [WordPress Trac] #35667: Maximum execution time error in WP_Text_Diff_Renderer_Table

WordPress Trac noreply at wordpress.org
Sat Jan 30 22:32:42 UTC 2016


#35667: Maximum execution time error in WP_Text_Diff_Renderer_Table
--------------------------+------------------
 Reporter:  ocean90       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.5
Component:  Revisions     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------

Comment (by ocean90):

 This seems to be an issue within
 `WP_Text_Diff_Renderer_Table->interleave_changed_lines()`.

 In [attachment:array-matches.txt] we have an array with 9752 keys (Number
 of keys in `$orig` * number of keys in `$final`, 92*106), the result of
 the match process.

 In [attachment:interleave_changed_lines.txt] we have the output of the
 second last foreach loop. As you can see it tries to find the original and
 final position and when there is a diff it increases the array. At the
 time of the timeout the size of `$final_rows` is at '''13000'''. Reminder:
 The number of final rows was only 106.

 IMO the huge position diffs are wrong somehow, for example
 {{{
 $orig_matches[$orig_row]: 51
 $final_pos: 52
 $orig_pos: 7
 }}}

 Since only the spaces are removed the final position should be the same as
 `$orig`, maybe +-2, but not +45.
 I've the feeling that the previous
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-
 diff.php?rev=34348&marks=357-380#L356 match process] matches lines wrong
 which is a result of the
 [https://core.trac.wordpress.org/browser/trunk/src/wp-includes/wp-
 diff.php?rev=34348&marks=352#L345 "order by string distance" in line 352].
 Removing that line prevents the timeout but the final UI output is
 different.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35667#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list