Horrible collisions of death when adding a table w/ same name as Drupal table or existing view

webchick - October 28, 2009 - 17:18
Project:Table Wizard
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

Try and pull in a 'node' table from a db_url connection to 4.7 or 5 site. Hilarity ensues!

    * warning: Illegal offset type in /Users/webchick/Sites/pug/sites/all/modules/views/includes/query.inc on line 96.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 17.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 37.
    * warning: Illegal offset type in isset or empty in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 120.
    * warning: class_exists() expects parameter 1 to be string, array given in /Users/webchick/Sites/pug/sites/all/modules/views/includes/handlers.inc on line 81.

I guess what's happening is Views module already defines a 'node' table in its hook_views_data(), and so it's merging the arrays into some kind of frankenstein thing.

I wonder if it's possible to somehow indicate for TW's purposes that a node actually comes from an external database. Maybe prefixing it like 'extdbkey-node' or something...

This might also be totally out of TW's control and instead be a limitation in Views module. But not having the ability to migrate data from older Drupal sites (or any application that defines a table called 'users', I imagine...) seems like a pretty critical limitation.

#1

webchick - October 28, 2009 - 17:24

Oh, btw, to test this particular thing you will need to:

1. Drop the nid portion of the primary key, since TW/Views can only deal with single-column primary keys, not composite keys.
2. Click "Analyze" and tell it to set up a default view called something other than 'node', since it informs you there's already a view called 'node'.
3. Click on the view's link to see it.

I'm sure there are far simpler test cases though, like trying to pull in something like aggregator tables.

I guess maybe the warning in #2 this is it trying to protect against this problem, but there is not a /view/ called node, though there is a /base table/ called node. I also noticed that when going to admin/build/views/add, I get an entry there with a title of Array and a description of Array for this table.

#2

dww - November 6, 2009 - 20:21
Title:Horrible collisions of death when adding a table w/ same name as Drupal table» Horrible collisions of death when adding a table w/ same name as Drupal table or existing view

#623764: tw_views_default_views() causes array_merge_recursive() warning in module_invoke_all() was marked duplicate as this. In my case, it was a table called "calendar" that matched an existing view on the site. Changing title to expand scope of this issue, I guess...

#3

mikeryan - November 6, 2009 - 21:02

@webchick - I couldn't reproduce this. Then I reverted the Views patch from http://drupal.org/node/576694#comment-2235136 (supporting #610128: Can't add external and internal tables' columns to the same view) and I could. So, it seems that this will address your problem.

@dww - Can you try applying the patch from http://drupal.org/node/576694#comment-2235136 and updating to the latest CVS of Table Wizard? If that fails to fix your problem, then please reopen your original issue, it really is different from this...

Thanks.

 
 

Drupal is a registered trademark of Dries Buytaert.