Fix #19816: Explicitly pass $fallbackToMaster as true to getSlavePdo() to ensure it is not affected by child class with changed defaults

This commit is contained in:
Luke English
2023-05-04 13:36:33 +01:00
committed by GitHub
parent 4e23de91aa
commit 6e7d0fbff4
11 changed files with 18 additions and 17 deletions

View File

@ -410,7 +410,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
}
$version = $cache ? $cache->get($key) : null;
if (!$version) {
$version = $this->db->getSlavePdo()->getAttribute(\PDO::ATTR_SERVER_VERSION);
$version = $this->db->getSlavePdo(true)->getAttribute(\PDO::ATTR_SERVER_VERSION);
if ($cache) {
$cache->set($key, $version, $this->db->schemaCacheDuration);
}

View File

@ -484,7 +484,7 @@ SQL;
protected function isOldMysql()
{
if ($this->_oldMysql === null) {
$version = $this->db->getSlavePdo()->getAttribute(\PDO::ATTR_SERVER_VERSION);
$version = $this->db->getSlavePdo(true)->getAttribute(\PDO::ATTR_SERVER_VERSION);
$this->_oldMysql = version_compare($version, '5.1', '<=');
}