Skip to content

Commit 695c31e

Browse files
committed
KSES: Optimize PCRE pattern detecting numeric character references.
Props dmsnell, xknown, johnbillion. git-svn-id: https://develop.svn.wordpress.org/trunk@61882 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 14ab358 commit 695c31e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/wp-includes/kses.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,8 +2118,8 @@ function wp_kses_normalize_entities( $content, $context = 'html' ) {
21182118
*
21192119
* Here, each input is normalized to an appropriate output.
21202120
*/
2121-
$content = preg_replace_callback( '/&#(0*[0-9]{1,7});/', 'wp_kses_normalize_entities2', $content );
2122-
$content = preg_replace_callback( '/&#[Xx](0*[0-9A-Fa-f]{1,6});/', 'wp_kses_normalize_entities3', $content );
2121+
$content = preg_replace_callback( '/&#(0*[1-9][0-9]{0,6});/', 'wp_kses_normalize_entities2', $content );
2122+
$content = preg_replace_callback( '/&#[Xx](0*[1-9A-Fa-f][0-9A-Fa-f]{0,5});/', 'wp_kses_normalize_entities3', $content );
21232123
if ( 'xml' === $context ) {
21242124
$content = preg_replace_callback( '/&([A-Za-z]{2,8}[0-9]{0,2});/', 'wp_kses_xml_named_entities', $content );
21252125
} else {

0 commit comments

Comments
 (0)