From c910f4c9ec9af876675d96df3fa65d7fc4551cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 17 Aug 2010 16:33:30 +0200 Subject: [PATCH] Fix handling of unknown sort order. --- libraries/database_interface.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 9a40c554b..b7d122ce4 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -208,6 +208,10 @@ function PMA_usort_comparison_callback($a, $b) } else { $sorter = 'strcasecmp'; } + /* No sorting when key is not present */ + if (!isset($a[$GLOBALS['callback_sort_by']]) || ! isset($b[$GLOBALS['callback_sort_by']])) { + return 0; + } // produces f.e.: // return -1 * strnatcasecmp($a["SCHEMA_TABLES"], $b["SCHEMA_TABLES"]) return ($GLOBALS['callback_sort_order'] == 'ASC' ? 1 : -1) * $sorter($a[$GLOBALS['callback_sort_by']], $b[$GLOBALS['callback_sort_by']]);