fix return code for PHP exceptions

These have returned a 0 until now.
This commit is contained in:
Sarah Hoffmann 2022-03-16 21:44:02 +01:00
parent 42cd021d04
commit 17da5f45be

View File

@ -26,7 +26,7 @@ function userError($sMsg)
function exception_handler_json($exception)
{
http_response_code($exception->getCode());
http_response_code($exception->getCode() == 0 ? 500 : $exception->getCode());
header('Content-type: application/json; charset=utf-8');
include(CONST_LibDir.'/template/error-json.php');
exit();
@ -34,7 +34,7 @@ function exception_handler_json($exception)
function exception_handler_xml($exception)
{
http_response_code($exception->getCode());
http_response_code($exception->getCode() == 0 ? 500 : $exception->getCode());
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8" ?>'."\n";
include(CONST_LibDir.'/template/error-xml.php');