mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-28 07:50:24 +00:00
Avoid array_filter on explode()
The array_filter is likely meant to empty the array if the empty string was exploded ( `explode( "\n", '' ) === [ '' ]` ). However, it can also remove other stuff, e.g. the string '0'. An explicit comparison is easier to read & interpret, marginally faster, and avoids rare but not impossible edge cases. Change-Id: Ie77d65b56319664a2ac370f32341dc72b619a635
This commit is contained in:
parent
b7cda4de4c
commit
7a1d6dbdbb
|
@ -412,7 +412,7 @@ class AbuseFilterHooks {
|
|||
$tags = [];
|
||||
foreach ( $res as $row ) {
|
||||
$tags = array_merge(
|
||||
array_filter( explode( "\n", $row->afa_parameters ) ),
|
||||
$row->afa_parameters ? explode( "\n", $row->afa_parameters ) : [],
|
||||
$tags
|
||||
);
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ class AbuseFilterHooks {
|
|||
|
||||
foreach ( $res as $row ) {
|
||||
$tags = array_merge(
|
||||
array_filter( explode( "\n", $row->afa_parameters ) ),
|
||||
$row->afa_parameters ? explode( "\n", $row->afa_parameters ) : [],
|
||||
$tags
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue