]> git.joonet.de Git - adminer.git/commitdiff
Prevent PHP 7.1 warning about non-numeric values
authorJakub Vrana <jakub@vrana.cz>
Thu, 11 Jan 2018 15:21:33 +0000 (16:21 +0100)
committerJakub Vrana <jakub@vrana.cz>
Thu, 11 Jan 2018 15:22:29 +0000 (16:22 +0100)
adminer/drivers/mongo.inc.php
adminer/include/adminer.inc.php
adminer/include/driver.inc.php
adminer/select.inc.php
changes.txt

index f05ba571b3d708c4b15b1d4d189c19ae469561e5..cc58ef0cf7badde0251b53be2b27b9443b1a909e 100644 (file)
@@ -129,7 +129,7 @@ if (isset($_GET["mongo"])) {
                        return new Min_Result($this->_conn->_db->selectCollection($table)
                                ->find(array(), $select)
                                ->sort($sort)
-                               ->limit(+$limit)
+                               ->limit($limit != "" ? +$limit : 0)
                                ->skip($page * $limit)
                        );
                }
index 28293372a7a82420e808ba7b43842255740d771b..d997384f62b060b3c70cbf18efd02d9af0bcff68 100644 (file)
@@ -655,7 +655,7 @@ focus(qs('#username'));
                } elseif (preg_match('~^([+-]|\\|\\|)$~', $function)) {
                        $return = idf_escape($name) . " $function $return";
                } elseif (preg_match('~^[+-] interval$~', $function)) {
-                       $return = idf_escape($name) . " $function " . (preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+$~i", $value) ? $value : $return);
+                       $return = idf_escape($name) . " $function " . (preg_match("~^(\\d+|'[0-9.: -]') [A-Z_]+\$~i", $value) ? $value : $return);
                } elseif (preg_match('~^(addtime|subtime|concat)$~', $function)) {
                        $return = "$function(" . idf_escape($name) . ", $return)";
                } elseif (preg_match('~^(md5|sha1|password|encrypt)$~', $function)) {
index ba4c1ef0b632d16d3397cef9c1d2de1c088dc657..3be05dff722ce0ee6f23f6aeb8994721a90a9732 100644 (file)
@@ -27,7 +27,7 @@
                $query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);
                if (!$query) {
                        $query = "SELECT" . limit(
-                               ($_GET["page"] != "last" && +$limit && $group && $is_group && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) . "\nFROM " . table($table),
+                               ($_GET["page"] != "last" && $limit != "" && $group && $is_group && $jush == "sql" ? "SQL_CALC_FOUND_ROWS " : "") . implode(", ", $select) . "\nFROM " . table($table),
                                ($where ? "\nWHERE " . implode(" AND ", $where) : "") . ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : ""),
                                ($limit != "" ? +$limit : null),
                                ($page ? $limit * $page : 0),
index 3e7afd0f902b120e0b7e530eef8a5613b2f2b402..2d5c79c8200ebb2f95e6421b40edf3c309a357d1 100644 (file)
@@ -288,7 +288,7 @@ if (!$columns && support("table")) {
                }
 
                // use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest)
-               if ($_GET["page"] != "last" && +$limit && $group && $is_group && $jush == "sql") {
+               if ($_GET["page"] != "last" && $limit != "" && $group && $is_group && $jush == "sql") {
                        $found_rows = $connection->result(" SELECT FOUND_ROWS()"); // space to allow mysql.trace_mode
                }
 
@@ -440,7 +440,7 @@ if (!$columns && support("table")) {
                if (($rows || $page) && !is_ajax()) {
                        $exact_count = true;
                        if ($_GET["page"] != "last") {
-                               if (!+$limit) {
+                               if ($limit == "") {
                                        $found_rows = count($rows);
                                } elseif ($jush != "sql" || !$is_group) {
                                        $found_rows = ($is_group ? false : found_rows($table_status, $where));
@@ -453,7 +453,7 @@ if (!$columns && support("table")) {
                                }
                        }
 
-                       if (+$limit && ($found_rows === false || $found_rows > $limit || $page)) {
+                       if ($limit != "" && ($found_rows === false || $found_rows > $limit || $page)) {
                                echo "<p class='pages'>";
                                // display first, previous 4, next 4 and last page
                                $max_page = ($found_rows === false
index 44136d01b67cd7510a950d4d6cc1b84bb9e63e30..2255ec435d59467b2453112a522787efbadb9807 100644 (file)
@@ -1,4 +1,5 @@
 Adminer 4.3.2-dev:
+PHP 7.1: Prevent warning when using empty limit
 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