mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-09-25 03:08:16 +00:00
Fix count function
This commit is contained in:
parent
08d3857983
commit
308867d25c
|
@ -833,6 +833,8 @@ class AbuseFilterParser {
|
|||
protected function funcCount( $args ) {
|
||||
if( count( $args ) < 1 )
|
||||
throw new AFPExpection( "No params passed to ".__METHOD__ );
|
||||
|
||||
$offset = -1;
|
||||
|
||||
if (count($args) == 1) {
|
||||
$count = count( explode( ",", $args[0]->toString() ) );
|
||||
|
@ -841,7 +843,7 @@ class AbuseFilterParser {
|
|||
$haystack = $args[1]->toString();
|
||||
|
||||
$count = 0;
|
||||
while ( ($offset = strpos( $haystack, $needle, $offset )) !== false ) {
|
||||
while ( ($offset = strpos( $haystack, $needle, $offset + 1 )) !== false ) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue