Remove PHP 5.4 compatibility hacks

Change-Id: Id26a014478e5ec550bd81a8f660ddca7f6fd93f8
This commit is contained in:
Max Semenik 2016-07-28 15:35:40 -07:00
parent a11a02d833
commit 817b57a8fe

View file

@ -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(