Formatting: Improve performance of wpautop()
on large paragraphs.
Following [45585], older versions of PHP could segfault when attempting to autop paragraphs with 10,000+ characters. Rather than having to negative lookahead for every character in the paragraph (which could run into recursion limits), we can quickly jump ahead to the next tag and start checking from there. See #27350. git-svn-id: https://develop.svn.wordpress.org/trunk@45587 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
008630e97a
commit
969c17d82d
@ -582,7 +582,7 @@ function wpautop( $pee, $br = true ) {
|
||||
$pee = preg_replace( '#(<(' . $allblocksexceptp . ')[^>]*>)(((?!<p>|</\2>).)*)</p>#s', '$1$3', $pee );
|
||||
|
||||
// If an opening <p> tag is inside a block element tag, without a following closing <p> tag, remove it.
|
||||
$pee = preg_replace( '#<p>(((?!</p>).)*</' . $allblocksexceptp . '>)#s', '$1', $pee );
|
||||
$pee = preg_replace( '#<p>([^<]*(((?!</p>).)*)</' . $allblocksexceptp . '>)#s', '$1', $pee );
|
||||
|
||||
// Optionally insert line breaks.
|
||||
if ( $br ) {
|
||||
|
Loading…
Reference in New Issue
Block a user