require php-5.6 for 0.10.0; fixes #606 and remove invalid value NO_AUTO_CREATE_USER in mysql-attributes for mysql8

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-03 17:15:54 +01:00
parent 2da59f1055
commit 4a0be40f92
9 changed files with 44 additions and 69 deletions

View File

@@ -127,13 +127,8 @@ abstract class ApiParameter
// which class called us
$_class = get_called_class();
if (empty($trace)) {
// check php version for backtrace flags
$_traceopts = false;
if (version_compare(PHP_VERSION, "5.3.6", ">")) {
$_traceopts = DEBUG_BACKTRACE_IGNORE_ARGS;
}
// get backtrace
$trace = debug_backtrace($_traceopts);
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
// check class and function
$class = $trace[$level]['class'];

View File

@@ -267,7 +267,14 @@ class Database {
// build up connection string
$driver = 'mysql';
$dsn = $driver.":";
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"');
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$attributes = array('ATTR_ERRMODE' => 'ERRMODE_EXCEPTION');
$dbconf["dsn"] = array(

View File

@@ -41,8 +41,13 @@ class PowerDNS
// build up connection string
$driver = 'mysql';
$dsn = $driver . ":";
$version_server = PDO::getAttribute(PDO::ATTR_SERVER_VERSION);
$sql_mode = 'NO_ENGINE_SUBSTITUTION';
if (version_compare($version_server, '8.0.11', '<')) {
$sql_mode .= ',NO_AUTO_CREATE_USER';
}
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET names utf8,sql_mode="' . $sql_mode . '"'
);
$attributes = array(
'ATTR_ERRMODE' => 'ERRMODE_EXCEPTION'