diff --git a/includes/Linker.php b/includes/Linker.php index c7f7df9df67..f97701ffa3f 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -693,11 +693,9 @@ class Linker { list( $inside, $trail ) = self::splitTrail( $trail ); wfProfileOut( __METHOD__ ); - return Html::element( 'a', array( - 'href' => $href, - 'class' => 'new', - 'title' => $title->getPrefixedText() - ), $prefix . $text . $inside ) . $trail; + return '' . + htmlspecialchars( $prefix . $text . $inside, ENT_NOQUOTES ) . '' . $trail; } else { wfProfileOut( __METHOD__ ); return $this->makeKnownLinkObj( $title, $text, $query, $trail, $prefix ); @@ -751,7 +749,7 @@ class Linker { $url = $this->getUploadUrl( $title ); $class = 'new'; } - $alt = htmlspecialchars( $title->getText() ); + $alt = htmlspecialchars( $title->getText(), ENT_QUOTES ); if( $text == '' ) { $text = $alt; } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2a681980ce4..421bbb1e2bb 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1072,9 +1072,9 @@ class Parser { $df = DateFormatter::getInstance(); $text = $df->reformat( $this->mOptions->getDateFormat(), $text ); } - $text = $this->doAllQuotes( $text ); $text = $this->replaceInternalLinks( $text ); $text = $this->replaceExternalLinks( $text ); + $text = $this->doAllQuotes( $text ); # replaceInternalLinks may sometimes leave behind # absolute URLs, which have to be masked to hide them from replaceExternalLinks @@ -1841,6 +1841,11 @@ class Parser { $wasblank = ( $text == '' ); if ( $wasblank ) { $text = $link; + } else { + # Bug 4598 madness. Handle the quotes only if they come from the alternate part + # [[Lista d''e paise d''o munno]] -> Lista d''e paise d''o munno + # [[Criticism of Harry Potter|Criticism of ''Harry Potter'']] -> Criticism of Harry Potter + $text = $this->doQuotes($text); } # Link not escaped by : , create the various objects diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 49ceba293c9..bf94ea81be3 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -1462,12 +1462,10 @@ Link containing "<#" and ">#" as a hex sequences !! test Link containing double-single-quotes '' (bug 4598) -!! options -disabled !! input [[Lista d''e paise d''o munno]] !! result -
!! end @@ -1485,7 +1483,25 @@ Link containing double-single-quotes '' in text embedded in italics (bug 4598 sa !! input ''Some [[Link|pretty ''italics'' and stuff]]! !! result -Some pretty italics and stuff! +
Some pretty italics and stuff! +
+!! end + +!! test +Link with double quotes in title part (literal) and alternate part (interpreted) +!! input +[[File:Denys Savchenko ''Pentecoste''.jpg]] + +[[''Pentecoste'']] + +[[''Pentecoste''|Pentecoste]] + +[[''Pentecoste''|''Pentecoste'']] +!! result + !! end