_split() copied two arrays N times, where N is number of lines in diff.
This was done by $a = array_merge($a, ...);
Instead of doing this, new words are appended to the end of array
using []= syntax.
Bug: 47989
Change-Id: I41338a2a82fbc20d7511f4c79581880febeeeea5
if ( preg_match_all( '/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
$line, $m ) )
{
- $words = array_merge( $words, $m[0] );
- $stripped = array_merge( $stripped, $m[1] );
+ foreach ( $m[0] as $word ) {
+ $words[] = $word;
+ }
+ foreach ( $m[1] as $stripped_word ) {
+ $stripped[] = $stripped_word;
+ }
}
}
}