aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2016-08-29 14:15:12 +0200
committerplegall <plg@piwigo.org>2016-08-29 14:15:12 +0200
commit843ccb89c1997d551bc1fb5769c5fdaad9655082 (patch)
treeda8cb891b1e2e98b2a70ab5666631ea4d63baa84 /include
parentba627eeca83ab5090e996ae7033c8c1656c23255 (diff)
parenta09d6e062312c50079987d6bd9eca50e2c102e08 (diff)
Merge branch '2.8'HEADmaster
Diffstat (limited to '')
-rw-r--r--include/dblayer/functions_mysqli.inc.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/dblayer/functions_mysqli.inc.php b/include/dblayer/functions_mysqli.inc.php
index 5b40cfe5b..21adbeabe 100644
--- a/include/dblayer/functions_mysqli.inc.php
+++ b/include/dblayer/functions_mysqli.inc.php
@@ -73,6 +73,19 @@ function pwg_db_connect($host, $user, $password, $database)
{
throw new Exception('Connection to server succeed, but it was impossible to connect to database');
}
+
+ // MySQL 5.7 default settings forbid to select a colum that is not in the
+ // group by. We've used that in Piwigo, for years. As an immediate solution
+ // we can remove this constraint in the current MySQL session.
+ list($sql_mode_current) = pwg_db_fetch_row(pwg_query('SELECT @@SESSION.sql_mode'));
+
+ // remove ONLY_FULL_GROUP_BY from the list
+ $sql_mode_altered = implode(',', array_diff(explode(',', $sql_mode_current), array('ONLY_FULL_GROUP_BY')));
+
+ if ($sql_mode_altered != $sql_mode_current)
+ {
+ pwg_query("SET SESSION sql_mode='".$sql_mode_altered."'");
+ }
}
/**