Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.8
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 May 2009 at 15:22 UTC
Updated:
24 Mar 2010 at 20:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
sdrycroft commentedIt looks like this is the result of an upgrade from Drupal 5 (and its associated views module) to Drupal 6. I'm not experiencing this on a brand new site with exactly the same modules installed as the problem site.
I'm closing this issue for now, until I've investigated it further.
Comment #2
sdrycroft commentedI've looked further into this, and have discovered that the issue is caused by two different modules each trying to define views with the same "View name". module_invoke_all is never going to successfully merge views with the same "View name" (due to a view objects recursion), so the proposed patch instead calls each hook individually, adding the view to the array to cache if a view with that name isn't already present. It also calls watchdog if two views with the same name exist (allowing a site administrator to possibly do something about it).
Comment #3
sdrycroft commentedOoops!
Comment #4
sdrycroft commentedComment #5
James Andres commented+1
I have had similar situations arise when two developers on my team accidentally set up a view with the same name. That makes for a fun day of debugging ..
Comment #6
merlinofchaos commentedahh this issue got lost due to being marked needs work. Marking it needs review so that it'll show up in my patch queue.
Comment #7
dagmarI have relloled this patch against Views 3.x following the Coding Standards and made the patch using cvs diff -up to make easy the review.
Comment #8
dawehnerWatchdog uses
to be able to translate the output, so a dynamic parameter like $name could fill the locale database.
I'm on crack. Are you, too?
Comment #9
merlinofchaos commentedCommitted to all branches.
Comment #11
dawehnerremove tag
Comment #12
kenorb commentedThis feature changed the way how views are imported.
After implementing this patch, some of my views disappeared.
It happen, because this code calling hook_views_default_views TWICE!
Following code doesn't work after this patch:
I know that's maybe not the right way to import views, but the fact is that it broke some Views on the server after Views upgrade.
Comment #13
iva2k commentedGiven relevant discussion here I'm reopening this instead of creating a new issue.
1) Patch in #8 adds new but does not remove old call to hook_views_default_views, which makes every *_views_default_views() called twice (see line $default = module_invoke... at the top of the patch)
2) Code in #12 should be '"include" instead of "include_once" to be repeatable
Same problem as #12 happens in advanced_forum #687196: Fatal Error with core-overrides
Comment #14
iva2k commentedSince patch in #8 is committed to all branches, the fix is a one liner.
Patch attached. Tested.
Comment #15
dawehnerI think i wrote a patch alreay, but this patch looks fine, too.
Comment #16
merlinofchaos commentedThis patch only appears to apply to the 2.x branch, and is not needed for 3.x -- someone please confirm that for me. In the meantime, committed to 2.x
kenorb: While your use of include_once did help us discover a bug (perhaps we need tests here) it also should be highlighted that there are valid cases where default views will be loaded twice in a single page load -- in particular, during testing -- so you should use include and not include_once to ensure your views are always included.
Comment #17
dawehneryeah this is not needed for 3.x