Merge "Add missing parameter and suppress warnings for regex errors"

This commit is contained in:
jenkins-bot 2018-04-26 02:28:19 +00:00 committed by Gerrit Code Review
commit 0b35bdcae9
2 changed files with 5 additions and 1 deletions

View file

@ -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;
}

View file

@ -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' ) );