PleaseStand has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/338301 )
Change subject: ApiQueryBase::addWhereFld: Don't count uncountable values ...................................................................... ApiQueryBase::addWhereFld: Don't count uncountable values In PHP 7.2, count() will generate a warning if its argument is not an array or countable object. https://wiki.php.net/rfc/counting_non_countables addWhereFld() "[uses] count() to its full documented capabilities to simultaneously test for null, empty array or empty countable object" since r42536 (c4dd73000a734ddf). Thus, in PHP 7.2, a warning would occur in the common case in which a scalar value is provided. Avoid the warnings by checking, in the obvious way, whether the value is null or an empty array, as there is no apparent reason to check for countable objects containing zero items. Change-Id: I562ec00cbebcaa803855e033cd07806bbcc16af0 --- M includes/api/ApiQueryBase.php 1 file changed, 1 insertion(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/01/338301/1 diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 2d21865..c907187 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -261,9 +261,7 @@ * @param string|string[] $value Value; ignored if null or empty array; */ protected function addWhereFld( $field, $value ) { - // Use count() to its full documented capabilities to simultaneously - // test for null, empty array or empty countable object - if ( count( $value ) ) { + if ( $value !== null && $value !== [] ) { $this->where[$field] = $value; } } -- To view, visit https://gerrit.wikimedia.org/r/338301 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I562ec00cbebcaa803855e033cd07806bbcc16af0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: PleaseStand <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
