mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 06:03:49 +00:00
Remove PHP 5.4 compatibility hacks
Change-Id: Id26a014478e5ec550bd81a8f660ddca7f6fd93f8
This commit is contained in:
parent
a11a02d833
commit
817b57a8fe
|
@ -615,8 +615,6 @@ class AbuseFilterParser {
|
|||
|
||||
public static $funcCache = array();
|
||||
|
||||
private static $hasSmartPregMatchAll = null;
|
||||
|
||||
/**
|
||||
* Create a new instance
|
||||
*
|
||||
|
@ -627,11 +625,6 @@ class AbuseFilterParser {
|
|||
if ( $vars instanceof AbuseFilterVariableHolder ) {
|
||||
$this->mVars = $vars;
|
||||
}
|
||||
if ( self::$hasSmartPregMatchAll === null ) {
|
||||
// Starting with PHP 5.4, preg_match_all() allows omitting the '$matches' argument.
|
||||
$r = new ReflectionFunction( 'preg_match_all' );
|
||||
self::$hasSmartPregMatchAll = $r->getNumberOfRequiredParameters() === 2;
|
||||
}
|
||||
}
|
||||
|
||||
public function resetState() {
|
||||
|
@ -1583,13 +1576,8 @@ class AbuseFilterParser {
|
|||
$needle = preg_replace( '!(\\\\\\\\)*(\\\\)?/!', '$1\/', $needle );
|
||||
$needle = "/$needle/u";
|
||||
|
||||
if ( self::$hasSmartPregMatchAll ) {
|
||||
// Omit the '$matches' argument to avoid computing them, just count.
|
||||
$count = preg_match_all( $needle, $haystack );
|
||||
} else {
|
||||
$matches = array();
|
||||
$count = preg_match_all( $needle, $haystack, $matches );
|
||||
}
|
||||
// Omit the '$matches' argument to avoid computing them, just count.
|
||||
$count = preg_match_all( $needle, $haystack );
|
||||
|
||||
if ( $count === false ) {
|
||||
throw new AFPUserVisibleException(
|
||||
|
|
Loading…
Reference in a new issue