* In MagicWordArray::matchStartAndRemove(), fixed the case where the length of localised synonym is not precisely the length of the magic word ID plus one
* Fixed the case where matchStartAndRemove() removes the entire string, send empty string not false
* Fix brace style
if ( $regex === '' ) {
continue;
}
- preg_match( $regex, $text, $match );
- if ( $match ) {
- list( $found, $param ) = $this->parseMatch( $match );
- $text = substr( $text, strlen( $found ) + 1 );
- return $found;
+ if ( preg_match( $regex, $text, $m ) ) {
+ list( $id, $param ) = $this->parseMatch( $m );
+ if ( strlen( $m[0] ) >= strlen( $text ) ) {
+ $text = '';
+ } else {
+ $text = substr( $text, strlen( $m[0] ) );
+ }
+ return $id;
}
}
return false;
# Possibilities for substMatch: "subst", "safesubst" or FALSE
# Decide whether to expand template or keep wikitext as-is.
- if ( $this->ot['wiki'] )
- {
+ if ( $this->ot['wiki'] ) {
if ( $substMatch === false ) {
$literal = true; # literal when in PST with no prefix
} else {