From ff9127739b930824a29d0ecb2494d7ed26175b73 Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Tue, 11 Aug 2020 11:51:58 +0100 Subject: [PATCH 1/3] FIX: Remove shutdown function for error output (fixes #204) --- src/BulkTools/HTTPBulkToolsResponse.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/BulkTools/HTTPBulkToolsResponse.php b/src/BulkTools/HTTPBulkToolsResponse.php index ad830e3..cdcb3a4 100644 --- a/src/BulkTools/HTTPBulkToolsResponse.php +++ b/src/BulkTools/HTTPBulkToolsResponse.php @@ -111,8 +111,6 @@ class HTTPBulkToolsResponse extends HTTPResponse $this->removesRows = $removesRows; $this->gridField = $gridfield; - register_shutdown_function(array($this, 'shutdown')); - parent::__construct(null, $statusCode); } @@ -362,18 +360,4 @@ class HTTPBulkToolsResponse extends HTTPResponse $this->createBody(); parent::outputBody(); } - - /** - * Catches fatal PHP error and output something useful for the front end - */ - public function shutdown() - { - $error = error_get_last(); - if ($error !== null ) { - $this->setMessage($error['message']); - $this->setStatusCode(500, $error['message']); - $this->outputBody(); - exit(); - } - } } From a2aa7475a54fc74b54afd5eda508b7ce5eee6449 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 2 Jun 2021 10:21:48 +1200 Subject: [PATCH 2/3] Update HTTPBulkToolsResponse.php --- src/BulkTools/HTTPBulkToolsResponse.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/BulkTools/HTTPBulkToolsResponse.php b/src/BulkTools/HTTPBulkToolsResponse.php index cdcb3a4..94a2f99 100644 --- a/src/BulkTools/HTTPBulkToolsResponse.php +++ b/src/BulkTools/HTTPBulkToolsResponse.php @@ -360,4 +360,12 @@ class HTTPBulkToolsResponse extends HTTPResponse $this->createBody(); parent::outputBody(); } + + /** + * This empty function exists only for semver + */ + public function shutdown() + { + // noop + } } From 4e82c461de9cc4ddb64f989b27e462f991ea9c73 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 2 Jun 2021 16:32:50 +1200 Subject: [PATCH 3/3] Update src/BulkTools/HTTPBulkToolsResponse.php Co-authored-by: Maxime Rainville --- src/BulkTools/HTTPBulkToolsResponse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BulkTools/HTTPBulkToolsResponse.php b/src/BulkTools/HTTPBulkToolsResponse.php index 94a2f99..b131dbd 100644 --- a/src/BulkTools/HTTPBulkToolsResponse.php +++ b/src/BulkTools/HTTPBulkToolsResponse.php @@ -362,7 +362,7 @@ class HTTPBulkToolsResponse extends HTTPResponse } /** - * This empty function exists only for semver + * @deprecated 3.1.0 This function was used to catch PHP Errors and inject additional information in the response */ public function shutdown() {