You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.phpreturn ['foo' => 'foo'];
// render-foo.php$result = $files->render(__DIR__ . '/foo.php');
// result will be ['foo' => 'foo']
This is not:
// bar.phpreturn [];
// render-bar.php$result = $files->render(__DIR__ . '/bar.php');
// result will be '' and not []
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.