ENH Improve scalar response handling

This resolves an issue where method_exists() was being called on scalar
response values, which is not supported in PHP 8.
This commit is contained in:
Garion Herman 2020-10-23 16:31:50 +13:00
parent f00f64120d
commit 91f831cd0b

View File

@ -230,7 +230,9 @@ class Controller extends RequestHandler implements TemplateGlobalProvider
*/
protected function prepareResponse($response)
{
if ($response instanceof HTTPResponse) {
if (!is_object($response)) {
$this->getResponse()->setBody($response);
} elseif ($response instanceof HTTPResponse) {
if (isset($_REQUEST['debug_request'])) {
$class = static::class;
Debug::message(