Prevent PHP 7.1 warning about non-numeric values

This commit is contained in:
Jakub Vrana 2018-01-11 16:21:33 +01:00
parent 329fa55af5
commit 72b199378a
5 changed files with 7 additions and 6 deletions

View file

@ -129,7 +129,7 @@ if (isset($_GET["mongo"])) {
return new Min_Result($this->_conn->_db->selectCollection($table) return new Min_Result($this->_conn->_db->selectCollection($table)
->find(array(), $select) ->find(array(), $select)
->sort($sort) ->sort($sort)
->limit(+$limit) ->limit($limit != "" ? +$limit : 0)
->skip($page * $limit) ->skip($page * $limit)
); );
} }

View file

@ -655,7 +655,7 @@ focus(qs('#username'));
} elseif (preg_match('~^([+-]|\\|\\|)$~', $function)) { } elseif (preg_match('~^([+-]|\\|\\|)$~', $function)) {
$return = idf_escape($name) . " $function $return"; $return = idf_escape($name) . " $function $return";
} elseif (preg_match('~^[+-] interval$~', $function)) { } 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)) { } elseif (preg_match('~^(addtime|subtime|concat)$~', $function)) {
$return = "$function(" . idf_escape($name) . ", $return)"; $return = "$function(" . idf_escape($name) . ", $return)";
} elseif (preg_match('~^(md5|sha1|password|encrypt)$~', $function)) { } elseif (preg_match('~^(md5|sha1|password|encrypt)$~', $function)) {

View file

@ -27,7 +27,7 @@
$query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page); $query = $adminer->selectQueryBuild($select, $where, $group, $order, $limit, $page);
if (!$query) { if (!$query) {
$query = "SELECT" . limit( $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) : ""), ($where ? "\nWHERE " . implode(" AND ", $where) : "") . ($group && $is_group ? "\nGROUP BY " . implode(", ", $group) : "") . ($order ? "\nORDER BY " . implode(", ", $order) : ""),
($limit != "" ? +$limit : null), ($limit != "" ? +$limit : null),
($page ? $limit * $page : 0), ($page ? $limit * $page : 0),

View file

@ -288,7 +288,7 @@ if (!$columns && support("table")) {
} }
// use count($rows) without LIMIT, COUNT(*) without grouping, FOUND_ROWS otherwise (slowest) // 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 $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()) { if (($rows || $page) && !is_ajax()) {
$exact_count = true; $exact_count = true;
if ($_GET["page"] != "last") { if ($_GET["page"] != "last") {
if (!+$limit) { if ($limit == "") {
$found_rows = count($rows); $found_rows = count($rows);
} elseif ($jush != "sql" || !$is_group) { } elseif ($jush != "sql" || !$is_group) {
$found_rows = ($is_group ? false : found_rows($table_status, $where)); $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'>"; echo "<p class='pages'>";
// display first, previous 4, next 4 and last page // display first, previous 4, next 4 and last page
$max_page = ($found_rows === false $max_page = ($found_rows === false

View file

@ -1,4 +1,5 @@
Adminer 4.3.2-dev: 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) MySQL: Remove dedicated view for replication status (added in 4.3.0)
PostgreSQL: Sort table names (regression from 4.3.1) PostgreSQL: Sort table names (regression from 4.3.1)
Editor: Don't set time zone from PHP, fixes DST Editor: Don't set time zone from PHP, fixes DST