X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FLinker.php;h=4d684b5ea1aa1ac98016cf4e773e56a0ff731d9c;hp=ff4c7861108c282f7596721593ed7349e97c44e1;hb=d029197c7c5b083edef20fa79cc3e6d58e161f72;hpb=d28eb17a50f95c169b46ae92f99d18c95ae30105 diff --git a/includes/Linker.php b/includes/Linker.php index ff4c786110..4d684b5ea1 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1232,6 +1232,14 @@ class Linker { $sectionText = str_replace( '[[', '[[', $auto ); $section = substr( Parser::guessSectionNameFromStrippedText( $section ), 1 ); + // Support: HHVM (T222857) + // The guessSectionNameFromStrippedText method returns a non-empty string + // 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 {