X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=9ec58346cc9ebe9b3d728d0f99a9e4263806aecf;hb=5155abe0e6ab6589d4104a221df0a0b2c5142c16;hp=962313e43e467bcd7c41fc0a351d2bc10221393f;hpb=327e8ea41681487382d8abe7cb111501954b9d1b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 962313e43e..9ec58346cc 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -910,7 +910,7 @@ class Parser { */ public function setTitle( $t ) { if ( !$t ) { - $t = Title::newFromText( 'NO TITLE' ); + $t = Title::makeTitle( NS_SPECIAL, 'Badtitle/Parser' ); } if ( $t->hasFragment() ) { @@ -2312,6 +2312,11 @@ class Parser { $line = $a->current(); # Workaround for broken ArrayIterator::next() that returns "void" $s = substr( $s, 1 ); + if ( is_null( $this->mTitle ) ) { + throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" ); + } + $nottalk = !$this->mTitle->isTalkPage(); + $useLinkPrefixExtension = $this->getTargetLanguage()->linkPrefixExtension(); $e2 = null; if ( $useLinkPrefixExtension ) { @@ -2319,14 +2324,6 @@ class Parser { # e.g. in the case of 'The Arab al[[Razi]]', 'al' will be matched $charset = $this->contLang->linkPrefixCharset(); $e2 = "/^((?>.*[^$charset]|))(.+)$/sDu"; - } - - if ( is_null( $this->mTitle ) ) { - throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" ); - } - $nottalk = !$this->mTitle->isTalkPage(); - - if ( $useLinkPrefixExtension ) { $m = []; if ( preg_match( $e2, $s, $m ) ) { $first_prefix = $m[2]; @@ -4271,7 +4268,6 @@ class Parser { * @param bool $isMain * @return mixed|string * @private - * @suppress PhanTypeInvalidDimOffset */ public function formatHeadings( $text, $origText, $isMain = true ) { # Inhibit editsection links if requested in the page @@ -5578,7 +5574,6 @@ class Parser { Hooks::run( 'ParserMakeImageParams', [ $title, $file, &$params, $this ] ); # Linker does the rest - // @phan-suppress-next-line PhanTypeInvalidDimOffset $time = $options['time'] ?? false; $ret = Linker::makeImageLink( $this, $title, $file, $params['frame'], $params['handler'], $time, $descQuery, $this->mOptions->getThumbSize() ); @@ -6192,7 +6187,9 @@ class Parser { */ private static function normalizeSectionName( $text ) { # T90902: ensure the same normalization is applied for IDs as to links + /** @var MediaWikiTitleCodec $titleParser */ $titleParser = MediaWikiServices::getInstance()->getTitleParser(); + '@phan-var MediaWikiTitleCodec $titleParser'; try { $parts = $titleParser->splitTitleString( "#$text" );