]> git.joonet.de Git - adminer.git/commitdiff
Avoid count(null)
authorJakub Vrana <jakub@vrana.cz>
Tue, 16 Jan 2018 15:22:24 +0000 (16:22 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 16 Jan 2018 15:22:24 +0000 (16:22 +0100)
adminer/db.inc.php
adminer/edit.inc.php
adminer/include/adminer.inc.php
adminer/select.inc.php
changes.txt

index 55f64bd91b749fe1088f9ac0d8a388476803efcf..671c232f2f31670945fa0256de05de353775f0aa 100644 (file)
@@ -4,7 +4,7 @@ $tables_views = array_merge((array) $_POST["tables"], (array) $_POST["views"]);
 if ($tables_views && !$error && !$_POST["search"]) {
        $result = true;
        $message = "";
-       if ($jush == "sql" && count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"] || $_POST["copy"])) {
+       if ($jush == "sql" && $_POST["tables"] && count($_POST["tables"]) > 1 && ($_POST["drop"] || $_POST["truncate"] || $_POST["copy"])) {
                queries("SET foreign_key_checks = 0"); // allows to truncate or drop several tables at once
        }
 
index b95dcfd33aa0a5ed86ce2f31ccd353ff9e1fda27..c2ffc98c18d455a361b29548761a246355fc4f8d 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 $TABLE = $_GET["edit"];
 $fields = fields($TABLE);
-$where = (isset($_GET["select"]) ? (count($_POST["check"]) == 1 ? where_check($_POST["check"][0], $fields) : "") : where($_GET, $fields));
+$where = (isset($_GET["select"]) ? ($_POST["check"] && count($_POST["check"]) == 1 ? where_check($_POST["check"][0], $fields) : "") : where($_GET, $fields));
 $update = (isset($_GET["select"]) ? $_POST["edit"] : $where);
 foreach ($fields as $name => $field) {
        if (!isset($field["privileges"][$update ? "update" : "insert"]) || $adminer->fieldName($field) == "") {
index 777cc3243f24c2adf192952536f8d2f3b1ef2bf5..2d7f88217143ab4df118324582506747c91b2988 100644 (file)
@@ -592,6 +592,9 @@ class Adminer {
                global $jush;
                restart_session();
                $history = &get_session("queries");
+               if (!$history[$_GET["db"]]) {
+                       $history[$_GET["db"]] = array();
+               }
                $id = "sql-" . count($history[$_GET["db"]]);
                if (strlen($query) > 1e6) {
                        $query = preg_replace('~[\x80-\xFF]+$~', '', substr($query, 0, 1e6)) . "\n..."; // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
index 8dfdc65a39dd3cb783d9564edcc4bd77d89ddd30..79a0a455362712d91ac68cbf7a8d47abc77c1289 100644 (file)
@@ -226,7 +226,7 @@ $set = null;
 if (isset($rights["insert"]) || !support("table")) {
        $set = "";
        foreach ((array) $_GET["where"] as $val) {
-               if (count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "="
+               if ($foreign_keys[$val["col"]] && count($foreign_keys[$val["col"]]) == 1 && ($val["op"] == "="
                        || (!$val["op"] && !preg_match('~[_%]~', $val["val"])) // LIKE in Editor
                )) {
                        $set .= "&set" . urlencode("[" . bracket_escape($val["col"]) . "]") . "=" . urlencode($val["val"]);
index 8f728b92ceb36c71330ea8013b114db819707adc..bbeb52e5d16d792fcc91cccecbc98165bd12281c 100644 (file)
@@ -5,6 +5,7 @@ Rate limit password-less login attempts from the same IP address
 Disallow connecting to privileged ports
 Add nosniff header
 PHP 7.1: Prevent warning when using empty limit
+PHP 7.2: Prevent warning when searching in select
 MySQL: Remove dedicated view for replication status (added in 4.3.0)
 PostgreSQL: Sort table names (regression from 4.3.1)
 Editor: Don't set time zone from PHP, fixes DST