Merge "Call parent::__construct() in MysqlBase AFTER transferring specific parameters"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 12 Oct 2016 16:49:35 +0000 (16:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 12 Oct 2016 16:49:35 +0000 (16:49 +0000)
1  2 
includes/libs/rdbms/database/DatabaseMysqlBase.php

@@@ -72,8 -72,6 +72,6 @@@ abstract class DatabaseMysqlBase extend
         * @param array $params
         */
        function __construct( array $params ) {
-               parent::__construct( $params );
                $this->lagDetectionMethod = isset( $params['lagDetectionMethod'] )
                        ? $params['lagDetectionMethod']
                        : 'Seconds_Behind_Master';
@@@ -89,6 -87,8 +87,8 @@@
                }
                $this->sqlMode = isset( $params['sqlMode'] ) ? $params['sqlMode'] : '';
                $this->utf8Mode = !empty( $params['utf8Mode'] );
+               parent::__construct( $params );
        }
  
        /**
         */
        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".
         *