From 9bfcdc76d8e2c9b0063276cf65cce68bdeaf1546 Mon Sep 17 00:00:00 2001 From: Maurits van der Schee Date: Sat, 13 Feb 2016 01:11:34 +0100 Subject: [PATCH] Refactor: dont reuse variable in processTablesParameter --- api.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api.php b/api.php index a0ee10a..825b36f 100644 --- a/api.php +++ b/api.php @@ -553,18 +553,18 @@ class REST_CRUD_API { } protected function processTablesParameter($database,$tables,$action,$db) { + $table_array = explode(',',$tables); + $table_list = array(); $blacklist = array('information_schema','mysql','sys','pg_catalog'); - if (in_array(strtolower($database), $blacklist)) return array(); - $tablelist = explode(',',$tables); - $tables = array(); - foreach ($tablelist as $table) { + if (in_array(strtolower($database), $blacklist)) return $tables; + foreach ($table_array as $table) { if ($result = $this->query($db,$this->queries['reflect_table'],array($table,$database))) { - while ($row = $this->fetch_row($result)) $tables[] = $row[0]; + while ($row = $this->fetch_row($result)) $table_list[] = $row[0]; $this->close($result); if ($action!='list') break; } } - return $tables; + return $table_list; } protected function findSinglePrimaryKey($tables,$database,$db) {