Skip to content

Commit bb38c1c

Browse files
author
Phil Sturgeon
committed
Merge pull request chriskacerguis#134 from kwoodfriend/csv-fix
to_csv() fix for non multi-dimensional arrays
2 parents 7d5d372 + 37a44e0 commit bb38c1c

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

application/libraries/Format.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function to_csv()
185185
$data = $this->_data;
186186

187187
// Multi-dimensional array
188-
if (isset($data[0]))
188+
if (isset($data[0]) && is_array($data[0]))
189189
{
190190
$headings = array_keys($data[0]);
191191
}

application/libraries/REST_Controller.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,20 @@ public function _remap($object_called, $arguments)
313313
}
314314

315315
// And...... GO!
316-
call_user_func_array(array($this, $controller_method), $arguments);
316+
$this->_fire_method(array($this, $controller_method), $arguments);
317+
}
318+
319+
/**
320+
* Fire Method
321+
*
322+
* Fires the designated controller method with the given arguments.
323+
*
324+
* @param array $method The controller method to fire
325+
* @param array $args The arguments to pass to the controller method
326+
*/
327+
protected function _fire_method($method, $args)
328+
{
329+
call_user_func_array($method, $args);
317330
}
318331

319332
/**

0 commit comments

Comments
 (0)