Merge pull request #205 from kinglozzer/no-shutdown

FIX: Remove shutdown function for error output (fixes #204)
This commit is contained in:
Steve Boyd 2021-06-02 16:33:10 +12:00 committed by GitHub
commit d51a26a872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,8 +111,6 @@ class HTTPBulkToolsResponse extends HTTPResponse
$this->removesRows = $removesRows; $this->removesRows = $removesRows;
$this->gridField = $gridfield; $this->gridField = $gridfield;
register_shutdown_function(array($this, 'shutdown'));
parent::__construct(null, $statusCode); parent::__construct(null, $statusCode);
} }
@ -362,18 +360,12 @@ class HTTPBulkToolsResponse extends HTTPResponse
$this->createBody(); $this->createBody();
parent::outputBody(); parent::outputBody();
} }
/** /**
* Catches fatal PHP error and output something useful for the front end * @deprecated 3.1.0 This function was used to catch PHP Errors and inject additional information in the response
*/ */
public function shutdown() public function shutdown()
{ {
$error = error_get_last(); // noop
if ($error !== null ) {
$this->setMessage($error['message']);
$this->setStatusCode(500, $error['message']);
$this->outputBody();
exit();
}
} }
} }