diff --git a/system/Debug/ExceptionHandler.php b/system/Debug/ExceptionHandler.php index d6f97b76a32b..41b67a626f37 100644 --- a/system/Debug/ExceptionHandler.php +++ b/system/Debug/ExceptionHandler.php @@ -76,7 +76,11 @@ public function handle( } if (! str_contains($request->getHeaderLine('accept'), 'text/html')) { - $data = (ENVIRONMENT === 'development' || ENVIRONMENT === 'testing') + $data = in_array( + strtolower(ini_get('display_errors')), + ['1', 'true', 'on', 'yes'], + true + ) ? $this->collectVars($exception, $statusCode) : ''; diff --git a/user_guide_src/source/changelogs/v4.5.6.rst b/user_guide_src/source/changelogs/v4.5.6.rst index 9490e62e4e80..f59885387a3f 100644 --- a/user_guide_src/source/changelogs/v4.5.6.rst +++ b/user_guide_src/source/changelogs/v4.5.6.rst @@ -42,6 +42,7 @@ Bugs Fixed - **Validation:** Fixed a bug where complex language strings were not properly handled. - **CURLRequest:** Added support for handling proxy responses using HTTP versions other than 1.1. - **Database:** Fixed a bug that caused ``Postgre\Connection::reconnect()`` method to throw an error when the connection had not yet been established. +- **Exception:** Fixed a bug where exceptions for non-HTML responses were not relying on the PHP ``display_errors`` setting. See the repo's `CHANGELOG.md `_