Skip to content

Commit

Permalink
refactor: replace str_ireplace() with in_array()
Browse files Browse the repository at this point in the history
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"
  • Loading branch information
kenjis committed Oct 26, 2023
1 parent f26b9dc commit f251a3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions system/Debug/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ protected function determineView(Throwable $exception, string $templatePath): st
$view = 'production.php';

if (
str_ireplace(
['off', 'none', 'no', 'false', 'null', '0'],
'',
ini_get('display_errors')
) !== ''
in_array(
strtolower(ini_get('display_errors')),
['1', 'true', 'on', 'yes'],
true
)
) {
$view = 'error_exception.php';
}
Expand Down
10 changes: 5 additions & 5 deletions system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ protected function determineView(Throwable $exception, string $templatePath): st
$templatePath = rtrim($templatePath, '\\/ ') . DIRECTORY_SEPARATOR;

if (
str_ireplace(
['off', 'none', 'no', 'false', 'null', '0'],
'',
ini_get('display_errors')
) !== ''
in_array(
strtolower(ini_get('display_errors')),
['1', 'true', 'on', 'yes'],
true
)
) {
$view = 'error_exception.php';
}
Expand Down

0 comments on commit f251a3c

Please sign in to comment.