Apache Version: 2.2.11
PHP Version: 5.2.11
Core: drupal-7.0-alpha5
Module: Webform 7.x-3.0-beta6
Error Message: Fatal error: [] operator not supported for strings in D:\wamp\www\drupal7\includes\form.inc on line 2661
Hi all,
Not sure if the problem lies with-in the core or the webform module.I created a new webform and added the following components (see screenshot).
I then browsed to the webforms url (in my case http://localhost/drupal7/content/book-now).
That is where I receive the blank page with the error message above.
I was able to resolve it by modifying the following 3 lines in the file includes/form.inc (starting on line 2657)
Change:
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = array();
}
To:
//if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = array();
//}
Comments
Comment #1
damien tournoud commentedProbably webform.
Comment #2
quicksketchYep, seems we're responsible. There's probably a component setting
$element['#attributes']['class']to a string instead of an array. The approach above actually will delete all classes entirely, which isn't what we want.There's probably a specific component responsible for this behavior, do you know which one it was that started causing this behavior?
Comment #3
asimmonds commentedFound some missing array() for class #attributes while grepping the code.
Comment #4
asimmonds commentedComment #6
baxr6 commentedPatch worked a treat
Comment #7
ryan88 commentedThanks... Worked Great!
Comment #8
quicksketchThanks asimmonds! Committed.
Comment #11
Jonathan Baltazar commentedApparently, the ['attributes']['class'] property must be set as an array in the $options array. It will throw this error if it is a string.
Comment #12
shrimphead commentedThanks #11 worked for me.