array_get : return null instead of an empty string

This commit is contained in:
Belle Aerni committed 2022-10-26 19:37:26 -07:00
1 parent 4d9fde7b04
commit d0a4e9e7e8
1 file changed
+2 -1
+2 -1
View File
@@ -423,7 +423,8 @@ $di['translate'] = $di->protect(function ($textDomain = '') use ($di) {
});
$di['array_get'] = $di->protect(function (array $array, $key, $default = null) {
return array_key_exists($key, $array) ? $array[$key] : $default;
$result = array_key_exists($key, $array) ? $array[$key] : $default;
return ($result === '') ? null : $result;
});
return $di;