-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
I'm using $files->render() in RockFrontend to get the result of AJAX endpoints. If the endpoint returns an array, RockFrontend will automatically set the content type to application/json.
Today I realised that if my file returns an empty array, ProcessWire will not return an empty array but an empty string!
This is ok:
// foo.php
return ['foo' => 'foo'];
// render-foo.php
$result = $files->render(__DIR__ . '/foo.php');
// result will be ['foo' => 'foo']
This is not:
// bar.php
return [];
// render-bar.php
$result = $files->render(__DIR__ . '/bar.php');
// result will be '' and not []
@ryancramerdesign is this intentional?
I have added a workaround in RockFrontend but I think when the files returns and empty array the result should be an empty array and not an empty string.