Follows-up
b6e1e99bec8, which switched the method from Title::makeTitleSafe
to TitleValue. The latter throws fatal on non-string $fragment.
Title::makeTitleSafe, on the other hand, uses makeName(), which casts
$fragment to a string, and ignores if it ends up as empty string
(boolean false becomes empty string and thus did "the right thing").
Bug: T222857
Change-Id: Iecc2140fabd31ef0f193740c7fab0fc698c38e51
$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 {
'<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#linkie.3F" title="Special:BlankPage">→[[linkie?]]</a></span></span>',
"/* [[linkie?]] */",
],
+ [
+ '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage" title="Special:BlankPage">→</a>: </span> // Edit via via</span>',
+ // Regression test for T222857
+ "/* */ // Edit via via",
+ ],
[
'<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→autocomment</a>: </span> post</span>',
"/* autocomment */ post",