From c7fa61e102527613cb38ee78692a10fadcb960db Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 4 Apr 2010 03:07:14 +0000 Subject: [PATCH] Cast subject of _deep_replace() to string to prevent an infinite loop. props mdawaffe, fixes #12386 git-svn-id: https://develop.svn.wordpress.org/trunk@13983 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 6b96739013..034f5b8191 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -2182,14 +2182,15 @@ function wp_htmledit_pre($output) { * @param string $subject * @return string The processed string */ -function _deep_replace($search, $subject){ +function _deep_replace( $search, $subject ) { $found = true; - while($found) { + $subject = (string) $subject; + while ( $found ) { $found = false; - foreach( (array) $search as $val ) { - while(strpos($subject, $val) !== false) { + foreach ( (array) $search as $val ) { + while ( strpos( $subject, $val ) !== false ) { $found = true; - $subject = str_replace($val, '', $subject); + $subject = str_replace( $val, '', $subject ); } } }