ApiQueryBase: Fix addWhereFld for PHP 7.2
authorBrad Jorsch <bjorsch@wikimedia.org>
Fri, 8 Dec 2017 16:46:58 +0000 (11:46 -0500)
committerReedy <reedy@wikimedia.org>
Fri, 8 Dec 2017 17:44:19 +0000 (17:44 +0000)
Idfe23a07d didn't go far enough with this method, it can be passed
arbitrary other scalars in addition to null and arrays.

Bug: T182377
Change-Id: I63ec23f70d6d7ad638aa382b740ec44d0ca47f85

includes/api/ApiQueryBase.php

index 8e9b1b4..179e6f7 100644 (file)
@@ -262,7 +262,7 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string|string[] $value Value; ignored if null or empty array;
         */
        protected function addWhereFld( $field, $value ) {
-               if ( $value !== null && count( $value ) ) {
+               if ( $value !== null && !( is_array( $value ) && !$value ) ) {
                        $this->where[$field] = $value;
                }
        }