mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@45587 git-svn-id: http://core.svn.wordpress.org/trunk@45398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7b95b1a86
commit
b57d185bb1
@ -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 ) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-45586';
|
||||
$wp_version = '5.3-alpha-45587';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user