$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 {