Cast subject of _deep_replace() to string to prevent an infinite loop. props mdawaffe, fixes #12386

git-svn-id: http://svn.automattic.com/wordpress/trunk@13983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-04-04 03:07:14 +00:00
parent e4aabba998
commit ecec297237
1 changed files with 6 additions and 5 deletions

View File

@ -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 );
}
}
}