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
This commit is contained in:
phpnut 2008-07-05 10:10:19 +00:00
parent 6ee4849172
commit 30a49a39e4
2 changed files with 8 additions and 1 deletions

View file

@ -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') {

View file

@ -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()) {