From d00927ce6656695a2a10254db0296af0a2b0eb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Barou=C5=A1?= Date: Tue, 26 Apr 2016 12:31:40 +0200 Subject: [PATCH] Improve limit check in edit-foreign plugin The limit is enforced in the query to prevent out-of-memory errors for big target tables. --- plugins/edit-foreign.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/edit-foreign.php b/plugins/edit-foreign.php index 0bb825a2..0b5227c6 100644 --- a/plugins/edit-foreign.php +++ b/plugins/edit-foreign.php @@ -30,7 +30,7 @@ class AdminerEditForeign { if (preg_match('~binary~', $field["type"])) { $column = "HEX($column)"; } - $options = array("" => "") + get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1"); + $options = array("" => "") + get_vals("SELECT $column FROM " . table($target) . " ORDER BY 1" . ($this->_limit ? " LIMIT " . ($this->_limit + 1) : "")); if ($this->_limit && count($options) - 1 > $this->_limit) { return; }