Permalink
Browse files

fix(mysql): adds MySQL 5.7 compatibility

Removes `ONLY_FULL_GROUP_BY` from MySQL's session `sql_mode`, as it's
incompatible with our queries.

Fixes #8121
  • Loading branch information...
mrclay committed Aug 25, 2016
1 parent 7ccf5fe commit 3198d84a5d000a48388bc39e0c08bdc2b1e63ee5
Showing with 4 additions and 0 deletions.
  1. +4 −0 engine/classes/Elgg/Database.php
@@ -173,6 +173,10 @@ public function connect($type = "readwrite") {
$this->connections[$type] = DriverManager::getConnection($params);
$this->connections[$type]->setFetchMode(\PDO::FETCH_OBJ);
// https://github.com/Elgg/Elgg/issues/8121
$sub_query = "SELECT REPLACE(@@SESSION.sql_mode, 'ONLY_FULL_GROUP_BY', '')";
$this->connections[$type]->exec("SET SESSION sql_mode=($sub_query);");
} catch (\PDOException $e) {
// @todo just allow PDO exceptions
// http://dev.mysql.com/doc/refman/5.1/en/error-messages-server.html

0 comments on commit 3198d84

Please sign in to comment.