Fix use of preg_match_all in MagicWord.php
Init variable before use Check return value to avoid notice on failures Change-Id: I5cecae32f7672d748706c7a72bf01e9aee65e6d4
This commit is contained in:
parent
6cf823b5cd
commit
2a87697894
1 changed files with 6 additions and 4 deletions
|
|
@ -950,10 +950,12 @@ class MagicWordArray {
|
|||
if ( $regex === '' ) {
|
||||
continue;
|
||||
}
|
||||
preg_match_all( $regex, $text, $matches, PREG_SET_ORDER );
|
||||
foreach ( $matches as $m ) {
|
||||
list( $name, $param ) = $this->parseMatch( $m );
|
||||
$found[$name] = $param;
|
||||
$matches = array();
|
||||
if ( preg_match_all( $regex, $text, $matches, PREG_SET_ORDER ) ) {
|
||||
foreach ( $matches as $m ) {
|
||||
list( $name, $param ) = $this->parseMatch( $m );
|
||||
$found[$name] = $param;
|
||||
}
|
||||
}
|
||||
$text = preg_replace( $regex, '', $text );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue