diff --git a/api/v1/entries/executions.php b/api/v1/entries/executions.php index 9d378362aa..08409c4bf0 100644 --- a/api/v1/entries/executions.php +++ b/api/v1/entries/executions.php @@ -20,7 +20,7 @@ class executionsEntry extends entry */ public function get($projectID = 0) { - $returnFields = explode(',', $this->param('return', '')); + $returnFields = $this->param('return', ''); $control = $this->loadController('execution', 'all'); $control->all($this->param('status', 'all'), $this->param('project', $projectID), $this->param('order', 'id_desc'), 0, 0, $this->param('limit', 20), $this->param('page', 1)); diff --git a/api/v1/entries/projects.php b/api/v1/entries/projects.php index 470731ef41..2ff535b664 100644 --- a/api/v1/entries/projects.php +++ b/api/v1/entries/projects.php @@ -21,7 +21,7 @@ class projectsEntry extends entry public function get($programID = 0) { if(!$programID) $programID = $this->param('program', 0); - $returnFields = explode(',', $this->param('return', '')); + $returnFields = $this->param('return', ''); $control = $this->loadController('project', 'browse'); $control->browse($programID, $this->param('status', 'all'), 0, $this->param('order', 'order_asc'), 0, $this->param('limit', 20), $this->param('page', 1)); diff --git a/framework/api/entry.class.php b/framework/api/entry.class.php index 41b6284a60..8eec15e274 100644 --- a/framework/api/entry.class.php +++ b/framework/api/entry.class.php @@ -532,10 +532,12 @@ class baseEntry public function filterFields($object, $allowable = '') { if(empty($allowable)) return $object; + if(is_string($allowable)) $allowable = explode(',', $allowable); $filtered = new stdclass(); foreach($allowable as $field) { + $field = trim($field); if(!isset($object->$field)) continue; $filtered->$field = $object->$field; }