language: Fix order of arguments in truncateHtml()

The arg order of truncate_endBracket is tag, type, lastCh, tags, but the
type and lastCh are in wrong order. This is only relevant when $tag is
still non-empty after the loop, which is only happen for unclosed html
tags.

Found by phan strict checks

Change-Id: I08d6926dd4aac8ccc86c776f57a26437013ecb1d
This commit is contained in:
Umherirrender 2022-03-08 23:05:48 +01:00
parent e663e2b14e
commit b8bb463dba
2 changed files with 5 additions and 1 deletions

View file

@ -3780,7 +3780,7 @@ class Language {
}
}
// Close the last tag if left unclosed by bad HTML
$this->truncate_endBracket( $tag, $text[$textLen - 1], $tagType, $openTags );
$this->truncate_endBracket( $tag, $tagType, $text[$textLen - 1], $openTags );
while ( count( $openTags ) > 0 ) {
$ret .= '</' . array_pop( $openTags ) . '>'; // close open tags
}

View file

@ -428,6 +428,10 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
'<p><font style="font-weight:bold;">123456789</font></p>',
'<p><font style="font-weight:bold;">123456789</font></p>',
],
[ 10, '***',
'<p><font style="font-weight:bold;">123456789</font',
'<p><font style="font-weight:bold;">123456789</font</p>',
],
];
}