Page MenuHomePhabricator

$log_ids can not be counted in AbuseFilter.hooks.php
Closed, ResolvedPublic

Description

Error log:

mod_fcgid: stderr: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /extensions/AbuseFilter/includes/AbuseFilter.hooks.php on line 257, referer: <URL>

mod_fcgid: stderr: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /extensions/AbuseFilter/includes/AbuseFilter.hooks.php on line 269, referer: <URL>

The line 257 ane line 269 is:

if ( count( $log_ids ) ) {

This is a PHP 7.2 compatibility issue. In PHP 7.2:

An E_WARNING will now be emitted when attempting to count() non-countable types (this includes the sizeof() alias function).

Event Timeline

Change 406986 had a related patch set uploaded (by 星耀晨曦; owner: 星耀晨曦):
[mediawiki/extensions/AbuseFilter@master] Avoid passing to count()

https://gerrit.wikimedia.org/r/406986

RazeSoldier renamed this task from $log_ids can not be counted to $log_ids can not be counted in AbuseFilter.hooks.php.Jan 31 2018, 3:52 PM

Change 406986 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Compatible with PHP 7.2, avoid passing null to count()

https://gerrit.wikimedia.org/r/406986