dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6cf823b
)
Fix use of preg_match_all in MagicWord.php
author
umherirrender
<umherirrender_de.wp@web.de>
Thu, 10 Sep 2015 19:43:46 +0000
(21:43 +0200)
committer
umherirrender
<umherirrender_de.wp@web.de>
Thu, 10 Sep 2015 19:43:46 +0000
(21:43 +0200)
Init variable before use
Check return value to avoid notice on failures
Change-Id: I5cecae32f7672d748706c7a72bf01e9aee65e6d4
includes/MagicWord.php
patch
|
blob
|
history
diff --git
a/includes/MagicWord.php
b/includes/MagicWord.php
index
833f852
..
2c7ba91
100644
(file)
--- a/
includes/MagicWord.php
+++ b/
includes/MagicWord.php
@@
-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 );
}