Skip to content

Commit f251a3c

Browse files
committed
refactor: replace str_ireplace() with in_array()
php > ini_set('display_errors', '1'); php > var_dump(ini_get('display_errors')); string(1) "1" php > ini_set('display_errors', 1); php > var_dump(ini_get('display_errors')); string(1) "1" php > ini_set('display_errors', true); php > var_dump(ini_get('display_errors')); string(1) "1" php > ini_set('display_errors', 'true'); php > var_dump(ini_get('display_errors')); string(4) "true"
1 parent f26b9dc commit f251a3c

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

system/Debug/ExceptionHandler.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@ protected function determineView(Throwable $exception, string $templatePath): st
130130
$view = 'production.php';
131131

132132
if (
133-
str_ireplace(
134-
['off', 'none', 'no', 'false', 'null', '0'],
135-
'',
136-
ini_get('display_errors')
137-
) !== ''
133+
in_array(
134+
strtolower(ini_get('display_errors')),
135+
['1', 'true', 'on', 'yes'],
136+
true
137+
)
138138
) {
139139
$view = 'error_exception.php';
140140
}

system/Debug/Exceptions.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,11 @@ protected function determineView(Throwable $exception, string $templatePath): st
254254
$templatePath = rtrim($templatePath, '\\/ ') . DIRECTORY_SEPARATOR;
255255

256256
if (
257-
str_ireplace(
258-
['off', 'none', 'no', 'false', 'null', '0'],
259-
'',
260-
ini_get('display_errors')
261-
) !== ''
257+
in_array(
258+
strtolower(ini_get('display_errors')),
259+
['1', 'true', 'on', 'yes'],
260+
true
261+
)
262262
) {
263263
$view = 'error_exception.php';
264264
}

0 commit comments

Comments
 (0)