bug 23588: properly colon-escape links used to replace transclusions if post-expand...
authorIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 19 May 2010 00:03:54 +0000 (00:03 +0000)
committerIlmari Karonen <vyznev@users.mediawiki.org>
Wed, 19 May 2010 00:03:54 +0000 (00:03 +0000)
includes/parser/Parser.php

index 16be4b1..bbd529c 100644 (file)
@@ -3130,8 +3130,16 @@ class Parser {
 
                if ( is_string( $text ) && !$this->incrementIncludeSize( 'post-expand', strlen( $text ) ) ) {
                        # Error, oversize inclusion
-                       $text = "[[$originalTitle]]" .
-                               $this->insertStripItem( '<!-- WARNING: template omitted, post-expand include size too large -->' );
+                       if ( $titleText !== false ) {
+                               # Make a working, properly escaped link if possible (bug 23588)
+                               $text = "[[:$titleText]]";
+                       } else {
+                               # This will probably not be a working link, but at least it may
+                               # provide some hint of where the problem is
+                               preg_replace( '/^:/', '', $originalTitle );
+                               $text = "[[:$originalTitle]]";
+                       }
+                       $text .= $this->insertStripItem( '<!-- WARNING: template omitted, post-expand include size too large -->' );
                        $this->limitationWarn( 'post-expand-template-inclusion' );
                }