X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=blobdiff_plain;f=includes%2FLinker.php;h=eb7a44f6b4d102e69a6069615f94b9f391cd3880;hb=0c4410a6233da6ee3e844f60b06a68f78a27ebd3;hp=3f50c97430043edbf682fc0670f9d045d69010c0;hpb=ceb1cd276fd6b46bf063b30232dd54af2c613b01;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Linker.php b/includes/Linker.php index 3f50c97430..eb7a44f6b4 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1237,18 +1237,17 @@ class Linker { // that starts with "#". Before PHP 7 (and still on HHVM) substr() would // return false if the start offset is the end of the string. // On PHP 7+, it gracefully returns empty string instead. - if ( $section === false ) { - $section = ''; - } - if ( $local ) { - $sectionTitle = new TitleValue( NS_MAIN, '', $section ); - } else { - $sectionTitle = $title->createFragmentTarget( $section ); - } - if ( $sectionTitle ) { + if ( $section !== '' && $section !== false ) { + if ( $local ) { + $sectionTitle = new TitleValue( NS_MAIN, '', $section ); + } else { + $sectionTitle = $title->createFragmentTarget( $section ); + } $auto = Linker::makeCommentLink( - $sectionTitle, $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText, - $wikiId, 'noclasses' + $sectionTitle, + $wgLang->getArrow() . $wgLang->getDirMark() . $sectionText, + $wikiId, + 'noclasses' ); } }