]> git.joonet.de Git - adminer.git/commitdiff
Fix handling of 64 bit numbers in auto_increment
authorJakub Vrana <jakub@vrana.cz>
Tue, 25 Nov 2014 02:17:43 +0000 (18:17 -0800)
committerJakub Vrana <jakub@vrana.cz>
Tue, 25 Nov 2014 02:17:43 +0000 (18:17 -0800)
adminer/create.inc.php
adminer/drivers/mssql.inc.php
adminer/drivers/mysql.inc.php
adminer/include/functions.inc.php
adminer/processlist.inc.php
adminer/script.inc.php
changes.txt
editor/script.inc.php

index d813dbb60711041efd5b9198476cedaaad656a91..7af80dd85c26fa74c3ec94aa30d9d561892321d0 100644 (file)
@@ -110,7 +110,7 @@ if ($_POST && !process_fields($row["fields"]) && !$error) {
                        ($row["Comment"] != $table_status["Comment"] ? $row["Comment"] : null),
                        ($row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : ""),
                        ($row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : ""),
-                       ($row["Auto_increment"] != "" ? +$row["Auto_increment"] : ""),
+                       ($row["Auto_increment"] != "" ? number($row["Auto_increment"]) : ""),
                        $partitioning
                ));
        }
index 423855e04ce41fe6c3a5c19121ca4f3c88a8578a..8a8f62065760aec2f8e1c9c8d92d3ad1f40ea937 100644 (file)
@@ -430,7 +430,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table)
        }
 
        function auto_increment() {
-               return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . (+$_POST["Auto_increment"]) . ",1)" : "") . " PRIMARY KEY";
+               return " IDENTITY" . ($_POST["Auto_increment"] != "" ? "(" . number($_POST["Auto_increment"]) . ",1)" : "") . " PRIMARY KEY";
        }
 
        function alter_table($table, $name, $fields, $foreign, $comment, $engine, $collation, $auto_increment, $partitioning) {
index 9add20c870c317807058ba654a7f955ba324a619..a16c02a8a8cca0c3d3dd8c4803db66678018384a 100644 (file)
@@ -649,7 +649,7 @@ if (!defined("DRIVER")) {
        * @param string
        * @param string
        * @param string
-       * @param int
+       * @param string number
        * @param string
        * @return bool
        */
index 05ff09360653f28e66d4e733966efb9f03796ef2..384534b3770ba66faa748a59c19fd0c0580d49ed 100644 (file)
@@ -33,6 +33,14 @@ function escape_string($val) {
        return substr(q($val), 1, -1);
 }
 
+/** Remove non-digits from a string
+* @param string
+* @return string
+*/
+function number($val) {
+  return preg_replace('~[^0-9]+~', '', $val);
+}
+
 /** Disable magic_quotes_gpc
 * @param array e.g. (&$_GET, &$_POST, &$_COOKIE)
 * @param bool whether to leave values as is
index d6e660a947b320300d2fc675009347c1b82ef361..ce60bcfc83ab5638a488bf73fddd7e4757f92bee 100644 (file)
@@ -2,7 +2,7 @@
 if (support("kill") && $_POST && !$error) {
        $killed = 0;
        foreach ((array) $_POST["kill"] as $val) {
-               if (queries("KILL " . (+$val))) {
+               if (queries("KILL " . number($val))) {
                        $killed++;
                }
        }
index 617ac114af9256b3a62619f28db6a2a8343062ae..62df6eaea423cc9fd50c434d0655f619453a5c1f 100644 (file)
@@ -33,7 +33,7 @@ if ($_GET["script"] == "db") {
        json_row("");
 
 } elseif ($_GET["script"] == "kill") {
-       $connection->query("KILL " . (+$_POST["kill"]));
+       $connection->query("KILL " . number($_POST["kill"]));
 
 } else { // connect
        foreach (count_tables($adminer->databases()) as $db => $val) {
index fce223dae00b3131aa0885a88fb5e327bac15748..37ac5e9ecda72b0fc3f89f40d92f56cec0cceb45 100644 (file)
@@ -9,6 +9,7 @@ Send 403 for auth error
 Report offline and other AJAX errors (bug #419)
 Don't alter table comment if not changed
 Add links to documentation on table status page
+Fix handling of 64 bit numbers in auto_increment
 MySQL: Use utf8mb4 if available
 MySQL: Support foreign keys in NDB storage
 PostgreSQL: Materialized views
index f7b1991b917a3ef81824ea5a71403cf68fd1ad7e..db57165cff524092223a54a537a26599efd5b4b7 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 if ($_GET["script"] == "kill") {
-       $connection->query("KILL " . (+$_POST["kill"]));
+       $connection->query("KILL " . number($_POST["kill"]));
 
 } elseif (list($table, $id, $name) = $adminer->_foreignColumn(column_foreign_keys($_GET["source"]), $_GET["field"])) {
        $limit = 11;