I just updated bootstrap module to version 8.x-3.13 and am seeing new warnings. Examples:
Warning: array_unique() expects parameter 1 to be array, string given in Drupal\bootstrap\Utility\Attributes->getClasses() (line 59 of themes\contrib\bootstrap\src\Utility\Attributes.php).
Warning: array_merge(): Argument #1 is not an array in Drupal\bootstrap\Utility\Attributes->addClass() (line 29 of themes\contrib\bootstrap\src\Utility\Attributes.php).
I realize this is most likely due to other modules/codes passing values incorrectly but I believe that bootstrap should check for this and handle it more gracefully.
Note - looks like this issue was seen in the past. Wondering if bug was reintroduced.
Issue fork bootstrap-3001556
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
markhalliwellCorrect. This is a valid error that indicates there is an issue with another developer who isn't using arrays properly.
This topic has indeed been a controversial one and this project already has an official stance on it: #2269653: [bootstrap][policy][7.x-3.x] CSS Classes (Fatal error: [] operator not supported for strings).
Perhaps, however, it needs a better explanation. I'll try to give a little more reason as to "why" this is the way it is.
Without getting into the history of "arrays in Drupal", the basics is this: arrays are arbitrary in nature and have no interface or mechanism in place to govern what should be in there. Thus the system that Drupal uses to render things (a.k.a. render arrays) are still, at their core, just arrays.
It's further compounded when there are nested arrays like attributes and then another array for classes. This is often referred to as "arrays of doom" by the community.
By introducing code that "softens" this warning (i.e. converting to an array if it's not), we're only continuing to permit "bad code" from other contrib projects. This increases the chance that something else may go wrong in this complicated render "API" process.
Suffice it to say, silencing an error by "fixing" it during runtime (which also has its own performance impacts BTW) is not actually solving the root issue: bad code introduced from another contrib project.
For this reason, no, this project will not enable other developers to make poor choices :D
Comment #3
guerinteed_mike commented@markcarver - appreciate the well thought out explanation.
Comment #4
londova commentedI have a similar problem.
I find that it is caused by module CAPTCHA. As soon as I uninstalled the CAPTCHA module, the problem disappear.