On a D6 test site I'm working with, when I visit admin/settings/service_links/services I get a bunch of PHP notices like this:
notice: Undefined offset: 0 in /.../includes/form.inc on line 834.
This is inside form_get_error(). I added a little debugging code in there to print out the $element when it's having trouble, and got a bunch of entries like this:
array(13) {
["#parents"]=>
array(0) {
}
["#tree"]=>
bool(false)
["#input"]=>
bool(true)
["#return_value"]=>
int(1)
["#process"]=>
array(1) {
[0]=>
string(16) "form_expand_ahah"
}
["#required"]=>
bool(false)
["#attributes"]=>
array(0) {
}
["#value"]=>
int(1)
["#id"]=>
string(33) "edit-service-links-show-delicious"
["#name"]=>
string(29) "service_links_show[delicious]"
["#description"]=>
NULL
["#type"]=>
string(8) "checkbox"
["#title"]=>
NULL
}
I don't have time to dig deeply into theme_service_links_drag_table() and all the magic it's doing to try to figure out what's going wrong. But there's clearly a bug in there somewhere, since if I just put return drupal_render($form); at the top of the function, the notices go away (along with the draggable table, obviously). ;) My suspicion is that something about the attempt to selectively render elements is confusing form API. Generally, it gets pissy if you never finish up with the drupal_render() on the whole form. I tried a few quick things but didn't have any luck, so I'm going to ignore it for now. But I wanted to open an issue with my findings in case anyone else is having the same problems and has better luck (and more time!) to debug. ;)
Cheers,
-Derek
p.s. I'm on PHP 5.3 in case that matters...
Comments
Comment #1
dwwSorry, duh. I forgot to mention something important. form.inc line 834 is this:
So, the notices are being thrown since $element has an empty array for #parents. That's the root of the problem. I'm just not sure why that's happening. ;)
Cheers,
-Derek
Comment #2
TheCrow commentedFixed in the last dev!