X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLinker.php;h=4d684b5ea1aa1ac98016cf4e773e56a0ff731d9c;hb=a52f0fdb944dc72762abb05518befafdfe031a86;hp=ff4c7861108c282f7596721593ed7349e97c44e1;hpb=3074a4521a18e78e52ba44cc7c185bac7af4a866;p=lhc%2Fweb%2Fwiklou.git 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 {