Skip to content

Commit d6853e6

Browse files
committed
do NOT return 404 when an empty array is sent to response instead DO return it
1 parent cefa36a commit d6853e6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

application/libraries/REST_Controller.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,21 +358,21 @@ protected function _fire_method($method, $args)
358358
* @param array $data
359359
* @param null|int $http_code
360360
*/
361-
public function response($data = array(), $http_code = null)
361+
public function response($data = null, $http_code = null)
362362
{
363363
global $CFG;
364364

365-
// If data is empty and not code provide, error and bail
366-
if (empty($data) && $http_code === null)
365+
// If data is NULL and not code provide, error and bail
366+
if ($data === NULL && $http_code === null)
367367
{
368368
$http_code = 404;
369369

370370
// create the output variable here in the case of $this->response(array());
371371
$output = NULL;
372372
}
373373

374-
// If data is empty but http code provided, keep the output empty
375-
else if (empty($data) && is_numeric($http_code))
374+
// If data is NULL but http code provided, keep the output empty
375+
else if ($data === NULL && is_numeric($http_code))
376376
{
377377
$output = NULL;
378378
}

0 commit comments

Comments
 (0)