rdbms: in Database::selectSQLText, do not treat $conds = "0" as no condition
authordaniel <daniel.kinzler@wikimedia.de>
Tue, 27 Feb 2018 18:08:47 +0000 (19:08 +0100)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 2 Mar 2018 10:25:44 +0000 (10:25 +0000)
commitfa9f1aca87cd1481bee9ae50928e95241832e350
tree3a3618b92a668551dab6a54a7f90dfb2c699826d
parent05bdcdbbd9c52f14b6de3897187b90174f49130a
rdbms: in Database::selectSQLText, do not treat $conds = "0" as no condition

This fixes an issue that arises because empty( "0" ) is true in PHP.

The new behavior rejects any conditions that are not strings or arrays,
and lets $conds = "0" be passed to the databases as WHERE 0.

Some databases may reject this as invalid syntax, which is the expected
behavior here, instead of silently ignoring the 0, causing no condition to
be applied to the query.

Bug: T188314
Change-Id: I5bc4d7f41221a886c85e54d9da67c4c095a7d9ce
includes/libs/rdbms/database/Database.php
tests/phpunit/includes/libs/rdbms/database/DatabaseSQLTest.php