From 30a49a39e45e54b7136d9b29e9ba23e163e71156 Mon Sep 17 00:00:00 2001 From: phpnut Date: Sat, 5 Jul 2008 10:10:19 +0000 Subject: [PATCH] Fixes #5016, Security->disabledFields not working properly. Empty value arrays needed to be unset git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7314 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/controller/components/security.php | 7 +++++++ cake/libs/view/helpers/form.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cake/libs/controller/components/security.php b/cake/libs/controller/components/security.php index ffa8fc0fc..c0fb15898 100644 --- a/cake/libs/controller/components/security.php +++ b/cake/libs/controller/components/security.php @@ -565,14 +565,21 @@ class SecurityComponent extends Object { if (in_array($value, $key)) { $remove = explode('.', $value); unset($check[$remove['0']][$remove['1']]); + if (empty($check[$remove['0']])) { + unset($check[$remove['0']]); + } } elseif (in_array('_' . $value, $key)) { $remove = explode('.', $value); $controller->data[$remove['0']][$remove['1']] = $controller->data['_' . $remove['0']][$remove['1']]; unset($check['_' . $remove['0']][$remove['1']]); + if (empty($check['_' . $remove['0']])) { + unset($check['_' . $remove['0']]); + } } } } ksort($check); + foreach ($check as $key => $value) { $merge = array(); if ($key === '__Token') { diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index b01b02e71..dae841af6 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -444,7 +444,7 @@ class FormHelper extends AppHelper { * * @param string $fieldName This should be "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param string $text Text that will appear in the label field. - * @param array $attributes Array of HTML attributes. + * @param array $attributes Array of HTML attributes. * @return string The formatted LABEL element */ function label($fieldName = null, $text = null, $attributes = array()) {