Skip to content

Commit 8e9f32e

Browse files
committed
fix: ci instance
Signed-off-by: otengkwame <developerkwame@gmail.com>
1 parent f418977 commit 8e9f32e

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

CodeIgniter/Framework/core/Exceptions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CI_Exceptions
7373
E_USER_ERROR => 'User Error',
7474
E_USER_WARNING => 'User Warning',
7575
E_USER_NOTICE => 'User Notice',
76-
2048 => 'Runtime Notice', // php8.4
76+
2048 => 'Runtime Notice', // php8.4 deprecated
7777
];
7878

7979
/**

Core/core/Base_Exceptions.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Base_Exceptions extends \CI_Exceptions
2121
E_USER_ERROR => 'User Error',
2222
E_USER_WARNING => 'User Warning',
2323
E_USER_NOTICE => 'User Notice',
24-
2048 => 'Runtime Notice', // php8.4
24+
2048 => 'Runtime Notice', // php8.4 deprecated
2525
E_DEPRECATED => "Deprecated"
2626
];
2727

@@ -63,11 +63,13 @@ public function show_error($heading, $message, $template = 'error_general', $sta
6363
$templates_path = VIEWPATH . 'errors' . DIRECTORY_SEPARATOR;
6464
}
6565

66-
$is_json_request = get_instance()->request->server('CONTENT_TYPE');
66+
$ci = CI_Instance::create();
6767

68-
if (str_contains($is_json_request ?? '', 'application/json')) {
68+
$isJsonRequest = $ci->request->server('CONTENT_TYPE');
6969

70-
get_instance()->output->json([
70+
if (str_contains($isJsonRequest ?? '', 'application/json')) {
71+
72+
$ci->output->json([
7173
"Severity: " => $severity ?? 'Error',
7274
"Message: " => (is_array($message) ? implode("\n\t", $message) : $message),
7375
], 500);
@@ -170,11 +172,13 @@ public function show_exception($exception)
170172
$_error->log_exception($num, $message, $filepath, $line);
171173
}
172174

173-
$is_json_request = get_instance()->request->server('CONTENT_TYPE');
175+
$ci = CI_Instance::create();
176+
177+
$isJsonRequest = $ci->request->server('CONTENT_TYPE');
174178

175-
if (str_contains($is_json_request ?? '', 'application/json')) {
179+
if (str_contains($isJsonRequest ?? '', 'application/json')) {
176180

177-
get_instance()->output->json([
181+
$ci->output->json([
178182
"Severity: " => $severity ?? 'Error',
179183
"Message: " => $message,
180184
"Filename: " => $filepath,
@@ -245,11 +249,13 @@ public function show_php_error($severity, $message, $filepath, $line)
245249
$_error->log_exception($severity, $message, $file, $line);
246250
}
247251

248-
$is_json_request = get_instance()->request->server('CONTENT_TYPE');
252+
$ci = CI_Instance::create();
253+
254+
$isJsonRequest = $ci->request->server('CONTENT_TYPE');
249255

250-
if (str_contains($is_json_request ?? '', 'application/json')) {
256+
if (str_contains($isJsonRequest ?? '', 'application/json')) {
251257

252-
get_instance()->output->json([
258+
$ci->output->json([
253259
"Severity: " => $severity ?? 'Error',
254260
"Message: " => $message,
255261
"Filename: " => $filepath,

0 commit comments

Comments
 (0)