Skip to content

Commit 8d51433

Browse files
committed
refactor: don't call array_key_exists() twice
1 parent e6ef70c commit 8d51433

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

system/Security/CheckPhpIni.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,10 @@ public static function checkIni(): array
141141
$ini = ini_get_all();
142142

143143
foreach ($items as $key => $values) {
144+
$hasKeyInIni = array_key_exists($key, $ini);
144145
$output[$key] = [
145-
'global' => array_key_exists($key, $ini) ? $ini[$key]['global_value'] : 'disabled',
146-
'current' => array_key_exists($key, $ini) ? $ini[$key]['local_value'] : 'disabled',
146+
'global' => $hasKeyInIni ? $ini[$key]['global_value'] : 'disabled',
147+
'current' => $hasKeyInIni ? $ini[$key]['local_value'] : 'disabled',
147148
'recommended' => $values['recommended'] ?? '',
148149
'remark' => $values['remark'] ?? '',
149150
];

0 commit comments

Comments
 (0)