mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-09-24 02:38:16 +00:00
Merge "Add missing parameter and suppress warnings for regex errors"
This commit is contained in:
commit
0b35bdcae9
|
@ -83,7 +83,7 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
);
|
||||
$this->showList(
|
||||
[ 'af_deleted' => 0 ],
|
||||
compact( 'deleted', 'hidedisabled', 'querypattern', 'searchmode', 'scope' )
|
||||
compact( 'deleted', 'hidedisabled', 'querypattern', 'searchmode', 'scope', 'searchEnabled' )
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -119,12 +119,14 @@ class AbuseFilterPager extends TablePager {
|
|||
}
|
||||
$length = mb_strlen( $this->mQuery[0], 'UTF8' );
|
||||
} elseif ( $this->mQuery[1] === 'RLIKE' ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
$check = preg_match(
|
||||
'/' . $this->mQuery[0] . '/',
|
||||
$row->af_pattern,
|
||||
$matches,
|
||||
PREG_OFFSET_CAPTURE
|
||||
);
|
||||
Wikimedia\restoreWarnings();
|
||||
// This may happen in case of catastrophic backtracking
|
||||
if ( $check === false ) {
|
||||
return htmlspecialchars( mb_substr( $row->af_pattern, 0, 50, 'UTF8' ) );
|
||||
|
@ -132,12 +134,14 @@ class AbuseFilterPager extends TablePager {
|
|||
$length = mb_strlen( $matches[0][0], 'UTF8' );
|
||||
$position = $matches[0][1];
|
||||
} elseif ( $this->mQuery[1] === 'IRLIKE' ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
$check = preg_match(
|
||||
'/' . $this->mQuery[0] . '/i',
|
||||
$row->af_pattern,
|
||||
$matches,
|
||||
PREG_OFFSET_CAPTURE
|
||||
);
|
||||
Wikimedia\restoreWarnings();
|
||||
// This may happen in case of catastrophic backtracking
|
||||
if ( $check === false ) {
|
||||
return htmlspecialchars( mb_substr( $row->af_pattern, 0, 50, 'UTF8' ) );
|
||||
|
|
Loading…
Reference in a new issue