There's some sort of weird interaction with bootstrap and references_dialog theming of action links. With core bartik no issues. After switching to bootstrap any node with a references_dialog widget can't be edited (maintenance error page displays instead) and results in the following watchdog entry:
Recoverable fatal error: Argument 3 passed to l() must be an array, string given, called in C:\inetpub\xxx\includes\theme.inc on line 1737 and defined in l() (line 2426 of C:\inetpub\xxx\includes\common.inc).
I've traced it down to the info added to the links array processed by theme_links. The bartik array looks like this:

while the bootstrap array looks like this:

It barfs on the non-null icon_position item that has a value of "before" when looping through the array with foreach ($links as $key => $link) in theme_links. I guess it safely ignores null items but I'm confused as to why there's a mixture of indexed and associative array items being processed with a foreach $index => $value loop in core to begin with. Seems like that's asking for trouble like this.
I have no clue what the proper way to fix it is yet, but a work around is to override core's theme_links in the bootstrap subtheme's template.php file and adding the following line right after the foreach ($links as $key => $link):
foreach ($links as $key => $link) {
if (!is_integer($key)) continue; //temp fix
$class = array($key);
// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$class[] = 'first';
}
if ($i == $num_links) {
$class[] = 'last';
}
if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) && (empty($link['language']) || $link['language']->language == $language_url->language)) {
$class[] = 'active';
}
$output .= '<li' . drupal_attributes(array('class' => $class)) . '>';
....
Anyway, I just wanted to get this posted in case anyone else stumbles across it-- took quite a bit debugging to figure out. I'll try to figure out a proper fix when I get a change.
In the meantime, suggestions would be welcome ;-)
| Comment | File | Size | Author |
|---|---|---|---|
| #42 | references_dialog_fix_theme_links-2315905-42.patch | 1.78 KB | Steven Merrill |
| #5 | references_dialog_fix_theme_links-2315905-5.patch.patch | 1.78 KB | WorldFallz |
Comments
Comment #1
markhalliwellThis isn't a Bootstrap base-theme issue. We're not overriding
theme_links()in any way, we're just adding the.list-inlineclass when appropriate: http://cgit.drupalcode.org/bootstrap/tree/templates/system/links.vars.php.From http://cgit.drupalcode.org/references_dialog/tree/references_dialog.modu...
This module is not using the theme system API properly. It is arbitrarily passing the argument
$links(which should actually be$variablesbtw) directly as thelinksparameter to thetheme_links()hook. This will, of course, blow up.$variablescan include various items (including some added by base-themes).This is what
theme_links()expects as it'slinksparameter:Comment #2
WorldFallz commentedThanks for the excellent description Mark! Now that I know where/what the bug is, I can submit a patch for it.
Comment #3
WorldFallz commentedThis should do it.
Comment #4
markhalliwellThis is correct. However there is one other place this needs to happen as well:
http://cgit.drupalcode.org/references_dialog/tree/references_dialog.modu...
FYI, classes should always be inside an array:
Comment #5
WorldFallz commentedThanks for the review, I can't believe I missed those. Updated patch attached.
Comment #6
markhalliwellLooks good to me, simple and straightforward.
Comment #7
socialnicheguru commentedcould this be related: https://www.drupal.org/node/1978118
(long shot but thought I'd mention it since this issue arises from 'some sort of weird interaction'.)
Comment #8
vacilando commentedBumped into this problem today right after updating from Drupal 7.32 to 7.33. Applied to patch and the problem went away!
Could someone please commit this to dev?
Comment #9
designerbrent commentedThis works perfectly to fix the problem. Would love to see this patch committed.
Comment #10
natemow commentedRe-rolled patch for beta1 release if anyone needs that instead.
Comment #12
acrosmanLooks like the patch in #10 is build from site root instead of the module root.
The patch in #5 applies just fine to the Beta1 release; I don't think it needed any re-rolling.
Setting back to reviewed by community in reference to patch from 5.
Comment #13
markhalliwellComment #14
anybodyThe patch works fine and I can confirm it solves the issue.
I'll be happy when the new stable version is released. :)
Comment #15
gmclelland commentedThe patch in #5 fixes the "Recoverable fatal error" I was getting when I tried to edit nodes after upgrading from 7.32 to 7.33.
Comment #16
morganl commentedComment #17
morganl commentedThis bug prevents sites from upgrading to Drupal 7.34, a security issue release. Please push a patch to the stable revision ASAP. Thanks!
Comment #18
rp7 commentedPatch works. Get this in ASAP please.
Comment #19
jesss commentedThe patch in #5 works for me. Please commit!
Comment #20
achtonThe patch in #5 did not apply cleanly for me on beta1 (contrary to some comments above). And the reroll in #10 is not correctly formatted. So here's a new patch for beta1, which applies cleanly (I'm using an archaic version of Drush Make here, YMMV).
Comment #24
markhalliwellPatches should always be against the latest HEAD (7.x-x.x branch, -dev), which is why the patch in #20 is failing tests. The patch in #5 should get committed.
Comment #25
achtonHmm, ok - I was trying to decipher the output from the bots and expected it to fail at "Detect a non-applicable patch" like with the patch in #10. Sorry 'bout the detour!
Comment #26
kristen polRTBC++ Thanks, WorldFallz!!!!!!!
Comment #27
WorldFallz commentedAnd thanks for Mark for mentoring me through this fix! Now to get it committed... I'm willing to be a comaintainer if necessary....
Comment #28
wroxbox commentedFixes the errors. Makes Node/add edit forms again usable. Thanks @WorldFallz
Comment #29
damienmckennaI couldn't find another tag for indicating a compatibility problem with specific core releases, so this'll have to do.
Comment #30
morganl commentedNote: This affects 7.x-1.0-beta1 as well, not just 7.x-1.x-dev.
Comment #31
markhalliwell-_- it affects everything, this issue/patch hasn't been committed to anything yet. 7.x-1.x-dev is just the repo's HEAD (aka: latest code) which is what patches should be applied to: https://www.drupal.org/patch/create
I have contacted both maintainers asking them to take action here.
Comment #32
morganl commentedThank you, Mark.
Comment #34
fmitchell commentedIf you're still getting this issue after applying the patch to either beta1 or 7.x-dev, it is also because you are probably running <= PHP 5.3 per https://www.drupal.org/node/2379771.
Upgrading to > PHP 5.3 (PHP 5.5 in my case) fixed the issue. If that is not an option, try applying the core patch referenced in the link or wait until 7.35 is released assuming that patch is included.
Comment #35
markhalliwellClosed #2379771: Adding 'theme_hook_original' triggers an unexpected PHP5.3 string conversion bug in theme_links as it's not a core issue.
Comment #36
nicxvan commentedI applied this patch, I'm not seeing any results though.
Comment #37
rogical commented@WorldFallz, I've added you as a maintainer, thanks!
Comment #39
WorldFallz commentedThanks for the vote of confidence rogical! I've committed this patch to dev. I plan to go through the issue queue and commit any other patches that are essentially RTBC'd before tagging a new official release.
Comment #40
WorldFallz commentedalmost forgot... yay!
Comment #42
Steven Merrill commentedThis may not be correct; let me double-check.
Comment #43
Argus commentedThis issue is closed (Fixed), why do you post a patch?
Comment #44
morganl commentedWhat's the process to get this patch pushed to 7.x-1.0 (not just dev)?
Comment #45
damienmckenna@MorganL: Wait for the maintainers to release a new version, or join as a new maintainer and help them get there.
Comment #46
damienmckenna@MorganL: Please move the discussion into #2414479: {META] Plan for References Dialog v7.x-1.0 release for what can be done to get v1.0 out the door.
Comment #47
morganl commented