Comparing a string column to 0 will produce spurious matches, and it is easy
to get a false value in unexpected places. Comparing an int column to '0'
does not seem to cause any problems.
Bug: T147537
Change-Id: I5ad547de509b3417b5937be6bdda9befb8aed8b6
*/
abstract protected function mysqlRealEscapeString( $s );
+ public function addQuotes( $s ) {
+ if ( is_bool( $s ) ) {
+ // Parent would transform to int, which does not play nice with MySQL type juggling.
+ // When searching for an int in a string column, the strings are cast to int, which
+ // means false would match any string not starting with a number.
+ $s = (string)(int)$s;
+ }
+ return parent::addQuotes( $s );
+ }
+
/**
* MySQL uses `backticks` for identifier quoting instead of the sql standard "double quotes".
*