Mercurial > hg > isophonics-drupal-site
diff core/lib/Drupal/Component/Utility/NestedArray.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line diff
--- a/core/lib/Drupal/Component/Utility/NestedArray.php Mon Apr 23 09:33:26 2018 +0100 +++ b/core/lib/Drupal/Component/Utility/NestedArray.php Mon Apr 23 09:46:53 2018 +0100 @@ -69,7 +69,7 @@ public static function &getValue(array &$array, array $parents, &$key_exists = NULL) { $ref = &$array; foreach ($parents as $parent) { - if (is_array($ref) && array_key_exists($parent, $ref)) { + if (is_array($ref) && (isset($ref[$parent]) || array_key_exists($parent, $ref))) { $ref = &$ref[$parent]; } else { @@ -219,7 +219,7 @@ public static function unsetValue(array &$array, array $parents, &$key_existed = NULL) { $unset_key = array_pop($parents); $ref = &self::getValue($array, $parents, $key_existed); - if ($key_existed && is_array($ref) && array_key_exists($unset_key, $ref)) { + if ($key_existed && is_array($ref) && (isset($ref[$unset_key]) || array_key_exists($unset_key, $ref))) { $key_existed = TRUE; unset($ref[$unset_key]); }