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.

Comments

webchick’s picture

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.

dww’s picture

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...

mikeryan’s picture

@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.

mikeryan’s picture

Status: Active » Postponed (maintainer needs more info)

Is this currently reproducible?

mikeryan’s picture

Status: Postponed (maintainer needs more info) » Fixed

No further info, presumed fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jp.stacey’s picture

I just got this with 6.x-1.2. From what I can gather from the comments thread, it was never actually fixed: the recommendation was to roll back something already committed to CVS.

I'm doing a selective import (so not everything) from a partially messed up Drupal 5 database into a new D6 site: my three table definitions so far are "users", "role" and, er, "users_roles". I think I've got those pluralizations right.

To repeat:

  • Select users table from import database
  • It will detect and then not create a view at this point, so then...
  • Click into the table's own page and select "create a default view"
  • Voila! Instant hilarity; just add BANG!

Is the temporary solution to call my view e.g. import_users ? I'm going to be doing that a lot, if so.

kcoop’s picture

I have the same problem. I'm running Open Atrium, Drupal 6.16.

The repro was really straightforward, just selected users table from Add existing tables, either with or without Provide default view selected.

very_random_man’s picture

Status: Closed (fixed) » Active

I'm also getting these warnings.

Table Wizard 6.x-1.2
Views 6.x-2.10

As soon as I added the node table, there were warnings a'plenty regardless of default view name or presence. When these warnings appear, there is also weirdness on the Add View page. The final entry in the list of view types is called Array.

I have a workaround.

If you need to add a table that is already defined by views (e.g. Node or Users), create a view (an SQL view, not a Drupal View!) that queries that table and use that view in Table Wizard instead of the original table.

For example, execute this in MySQL:
create view v_node as select * from node;
v_node will now be available for use by Table Wizard.

As a proof of concept, I used this technique to successfully add the node table and a content type table with the appropriate relationship to create views that extract CCK field data for given uid and node type. This allowed me to generate custom ubercart order reports that also included related CCK field values.

Not looked into it too deeply just yet so there may be some implications with using this technique. Just having a play, really!

Any thoughts?

very_random_man’s picture

Further info...

Looks like my workaround isn't 100% watertight. It works mostly but when I clear the Views cache and navigate to a page that contains View block displays, I get a single dose of warnings.


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

If I reload the page, the warnings go away. It only happens under the conditions i mentioned.

ceejayoz’s picture

Subscribing.

Daniel Norton’s picture

++

mikeryan’s picture

The last I looked, applying the patch http://drupal.org/files/issues/views3_handle_external_tables_1.patch to Views addressed this (see #576694: Enable views to handle external tables properly, allowing for joins across tables in different mysql databases for the related issue). It's been a while, so I'm not sure if that patch still applies to Views....

very_random_man’s picture

I'm guessing from the patch title that it applies to Views3 only. Are you aware of any Views2 solutions? I'm sure there's a few of us working on production sites and Views3 hasn't made it out of alpha yet.

mikeryan’s picture

That patch was originally against Views 2, actually, I guess Frank was hoping to at least get it accepted into Views 3.

johnhanley’s picture

This issue (i.e. the nastiness described in webchick's original post) is alive and well as of this writing using the latest releases of Table Wizard, Views, Migrate and Schema.

The workaround is to ALWAYS prefix duplicate source table names--even when they reside in a separate database. This is contrary to webchick's excellent article, which implied (logically so) that prefixing is only necessary when duplicate table names are contained in the same database.

mikeryan’s picture

Status: Active » Closed (won't fix)

As far as I can see, to support this cleanly requires #576694: Enable views to handle external tables properly, allowing for joins across tables in different mysql databases to be committed to Views. If someone comes up with a Table Wizard patch to work around it, reopen this issue.

Anonymous’s picture

subscribe

guysung’s picture

Subscribe.

cgapperi’s picture

Subscribe. Encountered with with update today.

elvizzi’s picture

Subscribe. Having same issues.

elvizzi’s picture

After updating Table Wizard to 6.x-1.x-dev and Views 6.x-3.x-dev things are working as I expected. I can add a non drupal table with Table Wizard, relate (join) a node table to it, and then in Views I can create a view with fields from both tables.

davea’s picture

* warning: class_exists() expects parameter 1 to be string, array given in /home/davea/mydev/drupal6/sites/all/modules/views/includes/handlers.inc on line 17.
* warning: class_exists() expects parameter 1 to be string, array given in /home/davea/mydev/drupal6/sites/all/modules/views/includes/handlers.inc on line 37.
* warning: Illegal offset type in isset or empty in /home/davea/mydev/drupal6/sites/all/modules/views/includes/handlers.inc on line 120.
* warning: class_exists() expects parameter 1 to be string, array given in /home/davea/mydev/drupal6/sites/all/modules/views/includes/handlers.inc on line 81.

Ran into this as well trying to make a calendar of events:
Drupal core 6.20
Views 6.x-2.12
Date 6.x-2.7
Calendar 6.x-2.4

This issue appears to be 1.5 years old. :(

Thanks,
Davea

johnhanley’s picture

@davea,

Explain how your apparent Views related problem has anything to do with Table Wizard and more specifically the issue described by the OP.

pragnatek’s picture

@elkabong I'm not having the same success as you.

Also Table Wizard to 6.x-1.x-dev and Views 6.x-3.x-dev. As soon as I add node table via Table Wizard I get the slew of warnings reported in #9.
Also as reported in #9 on the Add View page there is no node selection and the final entry in the list of view types is called Array.

Are you not seeing these warnings? And are you able to create a view of type Node?

chingis’s picture

#25, same here with views 6.x-2.12 and tw 6.x-1.3 when I try to analyze data table

nzcodarnoc’s picture

Subscribing - having the same error.

Jb33’s picture

subscribing with views 6.x-2.12 + table wizard 6.x-1.3