Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I got the following error message:
Recoverable fatal error: Argument 1 passed to drupal_attributes() must be of the type array, string given,
called in /home/hutch/www/test7/sites/all/themes/bootstrap3/templates/bootstrap/bootstrap-panel.vars.php on line 60
This can be avoided with a simple test, patch attached.
Comment | File | Size | Author |
---|---|---|---|
bootstrap_drupal_attributes_bug.patch | 632 bytes | hutch | |
Comments
Comment #1
markhalliwellThe issue lies in whatever is invoking the theme hook, not the theme hook itself. It expects there to be an array, but something else is passing a string. Similar to the related issue I am attaching here.
I'm closing as won't fix because as a design concept, PHP notices/warnings/fatals like this are actually an indication of user/developer implementation rather than a "bug" with the code. It's actually telling you that the problem lies in some module or whatever is implementing said theme hook and you should try fixing it there instead.
Simply "masking" them with something like the above patch is actually causes more damage than it's worth. You wouldn't really know where the degradation is actually happening and it would be next to impossible to debug properly, not to mention providing inconsistent results for the theme hook implementations.
Comment #2
hutch CreditAttribution: hutch commentedThe error occurred in the function bootstrap3_process_bootstrap_panel() which is an instance of hook_process_bootstrap_panel(). When I commented it out, thus allowing the default function bootstrap_process_bootstrap_panel() to be run instead, the error disappeared. The two functions are identical.
The error occurred on clicking on two links in two modules I maintain, Filepicker and Imagepicker, I searched both for incorrect use of
#attributes
and found none, they all used an array() to define the value.So I can't really explain the error and as there is a cure I'm not going to worry about it either :-)
Other than this very minor issue I have found the bootstrap theme quite usable and a good implementation of the Bootstrap Responsive Layouts system.