From 0ff6142dfaf15c060563cdd068d2334230b155ea Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 31 Oct 2005 21:40:18 +0000 Subject: [PATCH] * Fix Parser::unstrip on PHP 5.1.0RC4 --- RELEASE-NOTES | 1 + includes/Parser.php | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 55ea3a56ca..3ec4a41d71 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -195,6 +195,7 @@ fully support the editing toolbar, but was found to be too confusing. * (bug 3761) Avoid deprecation warnings in Special:Import * (bug 2885) Remove unnecessary reference parameter which broke classic skin talk notification on PHP 5.0.5 +* Fix Parser::unstrip on PHP 5.1.0RC4 === Caveats === diff --git a/includes/Parser.php b/includes/Parser.php index bb74782b6a..a39ff5ee7f 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -471,11 +471,10 @@ class Parser } # Must expand in reverse order, otherwise nested tags will be corrupted - $contentDict = end( $state ); - for ( $contentDict = end( $state ); $contentDict !== false; $contentDict = prev( $state ) ) { - if( key($state) != 'nowiki' && key($state) != 'html') { - for ( $content = end( $contentDict ); $content !== false; $content = prev( $contentDict ) ) { - $text = str_replace( key( $contentDict ), $content, $text ); + foreach( array_reverse( $state, true ) as $tag => $contentDict ) { + if( $tag != 'nowiki' && $tag != 'html' ) { + foreach( array_reverse( $contentDict, true ) as $uniq => $content ) { + $text = str_replace( $uniq, $content, $text ); } } } -- 2.20.1