diff options
author | David Rothstein <drothstein@gmail.com> | 2012-07-29 20:02:07 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2012-07-29 20:02:07 -0400 |
commit | 4d26c301ac838915c5a4e328096e8ae8809ea903 (patch) | |
tree | 57b25939ae018721b60605a2e0a874bbd22ea887 /includes | |
parent | 6d1ce3866cdd543bf7ae9a33439d37a33492d248 (diff) | |
download | brdo-4d26c301ac838915c5a4e328096e8ae8809ea903.tar.gz brdo-4d26c301ac838915c5a4e328096e8ae8809ea903.tar.bz2 |
Issue #635046 by claudiu.cristea, sun, fago: Fixed form_state_values_clean() is polluting form values.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 5 | ||||
-rw-r--r-- | includes/form.inc | 8 |
2 files changed, 7 insertions, 6 deletions
diff --git a/includes/common.inc b/includes/common.inc index 50f20e685..051efd55a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6493,7 +6493,7 @@ function drupal_array_set_nested_value(array &$array, array $parents, $value, $f * * @see drupal_array_set_nested_value() */ -function drupal_array_get_nested_value(array &$array, array $parents, &$key_exists = NULL) { +function &drupal_array_get_nested_value(array &$array, array $parents, &$key_exists = NULL) { $ref = &$array; foreach ($parents as $parent) { if (is_array($ref) && array_key_exists($parent, $ref)) { @@ -6501,7 +6501,8 @@ function drupal_array_get_nested_value(array &$array, array $parents, &$key_exis } else { $key_exists = FALSE; - return NULL; + $null = NULL; + return $null; } } $key_exists = TRUE; diff --git a/includes/form.inc b/includes/form.inc index 12d90053d..7d5a28c6e 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -2161,12 +2161,12 @@ function form_state_values_clean(&$form_state) { // $form_state['values']['foo']['bar'], which is the level where we can // unset 'baz' (that is stored in $last_parent). $parents = $button['#parents']; - $values = &$form_state['values']; $last_parent = array_pop($parents); - foreach ($parents as $parent) { - $values = &$values[$parent]; + $key_exists = NULL; + $values = &drupal_array_get_nested_value($form_state['values'], $parents, $key_exists); + if ($key_exists && is_array($values)) { + unset($values[$last_parent]); } - unset($values[$last_parent]); } } |