We get this error when attempting to edit Any node. Not sure why it popped, haven't modded any core files, and have a sneaking suspicion that SEOtools may have something to do with it, but can't prove it.

Any ideas?

Comments

comparellc’s picture

Line 991-993:
if (!empty($form['#disabled'])) {
$form['#attributes']['disabled'] = 'disabled';
}

This is the real drupal core form.inc. Why is this being thrown? I have very little experience in finding bugs, but I'm fairly sure this is something new..

dyesdyes’s picture

i had the same error. It was a syntax error in the form_alter. ($form['redirect'] instead of $form['#redirect'])

Hope it will help someone.

darrellduane’s picture

Thanks, this was helpful. I didn't have quite the same problem but it was an issue with my $form definition.

sam_habib’s picture

I am having the same issue. I did not edit any of the code in any of the modules and all of a sudden I get this message !!!

damien tournoud’s picture

Category: bug » support

This means that the form definition is severely incorrect somehow.

millenniumtree’s picture

Had this same error message.
In my case, I had named one of my block functions (that returns HTML text)
my_module_name_search()

So essentially, Drupal saw this as a 'hook_search' function and tried to use the return value as a $form object. Since it was a string, not a $form object, it died but ONLY on the search administration page.

Moral of the story - don't name your functions as a hook.
Since this module was written, I've taken to prefixing all non-hook functions with an underscore.

luizcarcerelli’s picture

My case was similar to millenniumtree. I umcomented some lines in galleria.module file wich implemente hook_form_alter and the error cames only in some pages (edit story content type for example).
Tank you vary much.

kerasai’s picture

Hopefully this helps someone in the future.

I ran into this in my hook_menu when using 'drupal_get_form' as the page callback and array('mymodule_some_form', 4) as the page arguments. The function definition of mymodule_some_form was as follows:

mymodule_some_form($form, $object_loaded_from_path_arg)

I get the error when tacking extra info onto $form like this:

$form['some_item'] = array(...)

I solved the issue by setting $form back to an empty array then putting my data into it. It must have had something funky in it (or possibly it was something that I shouldn't have been using) that caused the error.

feng-shui’s picture

Cheers

tutumlum’s picture

Thanks a lot!!!!!! for #8

kars-t’s picture

Status: Active » Fixed

Please close solved issues :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

orjantorang’s picture

I had for some reason switched places between the arguments $form_state and argument 2 in a hook_form causing the function to manipulate the $form_state, resulting in the "Fatal error: Cannot use string offset as an array..."

Correct order: function test_myform(&$form_state, $other)