From: Brion Vibber Date: Mon, 31 Oct 2005 21:40:18 +0000 (+0000) Subject: * Fix Parser::unstrip on PHP 5.1.0RC4 X-Git-Tag: 1.6.0~1258 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=0ff6142dfaf15c060563cdd068d2334230b155ea;p=lhc%2Fweb%2Fwiklou.git * Fix Parser::unstrip on PHP 5.1.0RC4 --- 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 ); } } }