Skip to content

Commit eae6010

Browse files
committed
fix: exceptions for non-HTML responses should rely on display_errors setting
1 parent 124a7e6 commit eae6010

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

system/Debug/ExceptionHandler.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ public function handle(
7676
}
7777

7878
if (! str_contains($request->getHeaderLine('accept'), 'text/html')) {
79-
$data = (ENVIRONMENT === 'development' || ENVIRONMENT === 'testing')
79+
$data = in_array(
80+
strtolower(ini_get('display_errors')),
81+
['1', 'true', 'on', 'yes'],
82+
true
83+
)
8084
? $this->collectVars($exception, $statusCode)
8185
: '';
8286

user_guide_src/source/changelogs/v4.5.6.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Bugs Fixed
4242
- **Validation:** Fixed a bug where complex language strings were not properly handled.
4343
- **CURLRequest:** Added support for handling proxy responses using HTTP versions other than 1.1.
4444
- **Database:** Fixed a bug that caused ``Postgre\Connection::reconnect()`` method to throw an error when the connection had not yet been established.
45+
- **Exception:** Fixed a bug where exceptions for non-HTML responses were not relying on the PHP ``display_errors`` setting.
4546

4647
See the repo's
4748
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_

0 commit comments

Comments
 (0)