diff --git a/adminer/drivers/mssql.inc.php b/adminer/drivers/mssql.inc.php
index 56793f30..2a1ca159 100644
--- a/adminer/drivers/mssql.inc.php
+++ b/adminer/drivers/mssql.inc.php
@@ -630,6 +630,13 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
return array();
}
+ /**
+ * @return bool
+ */
+ function is_strict_mode() {
+ return false;
+ }
+
function show_status() {
return array();
}
diff --git a/adminer/drivers/mysql.inc.php b/adminer/drivers/mysql.inc.php
index e90c0f4d..68726ecc 100644
--- a/adminer/drivers/mysql.inc.php
+++ b/adminer/drivers/mysql.inc.php
@@ -50,7 +50,7 @@ if (!defined("DRIVER")) {
$row = $result->fetch_array();
return $row[$field];
}
-
+
function quote($string) {
return "'" . $this->escape_string($string) . "'";
}
@@ -305,7 +305,7 @@ if (!defined("DRIVER")) {
}
return queries($prefix . implode(",\n", $values) . $suffix);
}
-
+
function slowQuery($query, $timeout) {
if (min_version('5.7.8', '10.1.2')) {
if (preg_match('~MariaDB~', $this->_conn->server_info)) {
@@ -322,7 +322,7 @@ if (!defined("DRIVER")) {
: $idf
);
}
-
+
function warnings() {
$result = $this->_conn->query("SHOW WARNINGS");
if ($result && $result->num_rows) {
@@ -1056,6 +1056,19 @@ if (!defined("DRIVER")) {
return get_key_vals("SHOW VARIABLES");
}
+ /**
+ * @return bool
+ */
+ function is_strict_mode() {
+ static $strictMode = null;
+
+ if ($strictMode === null) {
+ $strictMode = (bool)preg_match('~STRICT_(TRANS|ALL)_TABLES~', get_key_vals("SHOW VARIABLES LIKE 'sql_mode'")["sql_mode"]);
+ }
+
+ return $strictMode;
+ }
+
/** Get process list
* @return array ($row)
*/
diff --git a/adminer/drivers/oracle.inc.php b/adminer/drivers/oracle.inc.php
index fb31f9b4..ba1cfa8b 100644
--- a/adminer/drivers/oracle.inc.php
+++ b/adminer/drivers/oracle.inc.php
@@ -486,6 +486,13 @@ AND c_src.TABLE_NAME = " . q($table);
return get_key_vals('SELECT name, display_value FROM v$parameter');
}
+ /**
+ * @return bool
+ */
+ function is_strict_mode() {
+ return false;
+ }
+
function process_list() {
return get_rows('SELECT sess.process AS "process", sess.username AS "user", sess.schemaname AS "schema", sess.status AS "status", sess.wait_class AS "wait_class", sess.seconds_in_wait AS "seconds_in_wait", sql.sql_text AS "sql_text", sess.machine AS "machine", sess.port AS "port"
FROM v$session sess LEFT OUTER JOIN v$sql sql
diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php
index ae8ce512..3f215a41 100644
--- a/adminer/drivers/pgsql.inc.php
+++ b/adminer/drivers/pgsql.inc.php
@@ -860,6 +860,13 @@ AND typelem = 0"
return get_key_vals("SHOW ALL");
}
+ /**
+ * @return bool
+ */
+ function is_strict_mode() {
+ return false;
+ }
+
function process_list() {
return get_rows("SELECT * FROM pg_stat_activity ORDER BY " . (min_version(9.2) ? "pid" : "procpid"));
}
diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php
index f0127e4b..f80301af 100644
--- a/adminer/drivers/sqlite.inc.php
+++ b/adminer/drivers/sqlite.inc.php
@@ -764,6 +764,13 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return $return;
}
+ /**
+ * @return bool
+ */
+ function is_strict_mode() {
+ return false;
+ }
+
function show_status() {
$return = array();
foreach (get_vals("PRAGMA compile_options") as $option) {
diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php
index c69f7679..e105d77c 100644
--- a/adminer/include/functions.inc.php
+++ b/adminer/include/functions.inc.php
@@ -914,13 +914,16 @@ function column_foreign_keys($table) {
*/
function enum_input($type, $attrs, $field, $value, $empty = null) {
global $adminer;
+
+ $return = ($empty !== null && !is_strict_mode() ? "" : "");
+
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
- $return = ($empty !== null ? "" : "");
foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val));
$checked = (is_int($value) ? $value == $i+1 : (is_array($value) ? in_array($i+1, $value) : $value === $val));
$return .= " ';
}
+
return $return;
}
diff --git a/plugins/enum-option.php b/plugins/enum-option.php
index cc82a125..88c1821d 100644
--- a/plugins/enum-option.php
+++ b/plugins/enum-option.php
@@ -7,7 +7,7 @@
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerEnumOption {
-
+
function editInput($table, $field, $attrs, $value) {
if ($field["type"] == "enum") {
$options = array();
@@ -24,7 +24,9 @@ class AdminerEnumOption {
$selected = "";
}
}
- $options[0] = lang('empty');
+ if (!is_strict_mode()) {
+ $options[0] = lang('empty');
+ }
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val));
@@ -36,5 +38,5 @@ class AdminerEnumOption {
return ""; // 1 - use keys
}
}
-
+
}