Parser::extensionSubstitution() Don't run substr() on null

extensionSubstitution returns a string, not null,
so if $params['attr'] is not set, default to using
an empty string (''), not null.

Bug: T312519
Bug: T312520
Change-Id: I566d95a32cffe1ef20f18ae9d9af96d57e0823a9
This commit is contained in:
Reedy 2022-07-07 11:27:14 +01:00
parent c016da960a
commit 5d2feb1da1

View file

@ -3993,7 +3993,7 @@ class Parser {
return $name;
}
$attrText = !isset( $params['attr'] ) ? null : $frame->expand( $params['attr'] );
$attrText = !isset( $params['attr'] ) ? '' : $frame->expand( $params['attr'] );
if ( substr( $attrText, 0, $errorLen ) === $errorStr ) {
// See above
return $attrText;
@ -4034,9 +4034,6 @@ class Parser {
}
}
} else {
if ( $attrText === null ) {
$attrText = '';
}
if ( isset( $params['attributes'] ) ) {
foreach ( $params['attributes'] as $attrName => $attrValue ) {
$attrText .= ' ' . htmlspecialchars( $attrName ) . '="' .