Hi,

After updating to views 6.x-2.7 from views 6.x-2.6, I get the errors generated on the image attached.

I also disabled views module, then re-enabled it but still same errors again.

It seems to be working though but I'm not sure we should be getting errors.

Does any1 know whats going on?

Comments

harcher’s picture

Title: Updating ti views 6.x-2.7 displays errors » Updating to views 6.x-2.7 displays errors
dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

The last sql looks like views_view is empty. Can you check this?

I think this error is not really easy to reproduce.
Can you try to reproduce it on a clean drupal, perhaps it is possible that the error is only on acquia drupal.
We have to be able to reproduce it. I hope you understand it.

harcher’s picture

StatusFileSize
new64.75 KB

The table 'views_view' isn't empty (image attached).

harcher’s picture

Title: Disable then enable views displays errors » Updating to views 6.x-2.7 displays errors
Status: Active » Postponed (maintainer needs more info)

I can also confirm that on a new Acquia Drupal install (which initially has views 6.x-2.6), updating to 6.x-2.7 works as expected without any errors.

[EDIT]
However, I'm not sure this is true since I didn't add any display views when I did this test. So probably this is why there were no errors. If you'll notice what was said below, the warnings show up only when display views exist and are enabled.

harcher’s picture

Note that I made a backup copy of the database before I attempted the views update. I reverted to that database copy (i.e. back to views 2.6). I then attempted the same process to update to view 2.7, but still same errors.

It must be something in my database thats causing the update to break!

harcher’s picture

Could it be a conflict with another module? Maybe workflow or revisioning!

harcher’s picture

Ok, I just tried another test and now it's more strange.

I reverted to my 'working' database copy (so again, back to views 2.6). Ofcourse when reverting database, I also revert the source files. On the modules page, I disabled view 2.6 then re-enabled it (without updating views or anything else). I get the same error!

So this issue is nothing to do with views 2.7. Something went wrong in my current views 2.6 :(

harcher’s picture

StatusFileSize
new537.11 KB

I've attached image of errors when disabling/enabling views 2.6. Notice the sql error is now on line 1318

harcher’s picture

StatusFileSize
new134.91 KB

I've attached the views_display table

Does anything seem wrong?

dawehner’s picture

How do you do the updates?

I'm wondering why you are at admin/build/modules

Could you try once, to reproduce it on a normal (non-acquia) drupal?

harcher’s picture

I take the following steps to update,

- go to admin/build/modules
- disable the module that I want to update (by un-ticking the box), click submit
- delete the views module folder (modules/acquia/views)
- add the latest views module folder
- from admin/build/modules, enable the views module, click submit
- here I get the error

I would then goto update.php

But I don't think it's the update thats the issue now. Even if I don't update to 2.7, and just simply disable then enable 2.6, I get the same error.

dawehner’s picture

I tryed this too, and it does not appear.

Did you checked after the update, whether the views you have defined work well? There could be a distinct between acquia-views2.6 and views 2.6 i didn't tested yet.

harcher’s picture

Title: Disable then enable views displays errors » Updating to views 6.x-2.7 displays errors

I deleted all the view displays I created from the Views UI. This deleted all the rows from both views_view and views_display table. I then disabled/enabled 2.6 and it didn't show any errors.

Looks like I have some corrupt views stored in my views table. Can this happen?

dawehner’s picture

Sure it can, php drupal views and mysql aren't perfect software

harcher’s picture

Title: Updating to views 6.x-2.7 displays errors » Disable then enable views displays errors
harcher’s picture

Status: Active » Postponed (maintainer needs more info)

This is so wierd. I disabled and uninstalled most modules. I also uninstalled views module (this deletes all views tables).I then enabled views again (I don't get errors here since we don't have any stored display views at this point). Then I added a new view display using views UI. Disabled then enabled views, again I get the errors...

This is so annoying

Looking at the error:
"Invalid argument supplied for foreach..." I debugged this and it is recieving a valid array, $schema['fields'].
But it still generates this error, in views/includes/views.inc:

function load_row($data)
{
    $schema = drupal_get_schema($this->db_table);

    // it's complaining here that $schema['fields'] is invalid
    foreach ($schema['fields'] as $field => $info)
    {
        ...
    }
}

I just don't get it!

acephale’s picture

Title: Updating to views 6.x-2.7 displays errors » Disable then enable views displays errors

I also noticed this issue when I upgraded Views on a (non-Acquia) development site of mine.

Drupal: 6.14
PHP: 5.2.9
MySql: 5.0.67

The first time I re-enabled the module after upgrading, I got the same series of foreach warnings and the additional error mentioned. Since then, if I disable, then enable Views, I see the warnings and errors again. The only thing I can add to this is that the number of foreach warnings seems to correspond to the number of enabled views. So, in line with what was mentioned above, deleting all the views on the site kills the warnings.

Status Message:

  • The configuration options have been saved.
  • Skipping broken view

And then:

  • warning: Invalid argument supplied for foreach() in /home/android1/ecafrica.androidshepherd.com/sites/all/modules/views/includes/view.inc on line 1727.
  • warning: Invalid argument supplied for foreach() in /home/android1/ecafrica.androidshepherd.com/sites/all/modules/views/includes/view.inc on line 1727.
  • warning: Invalid argument supplied for foreach() in /home/android1/ecafrica.androidshepherd.com/sites/all/modules/views/includes/view.inc on line 1727.
  • user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY vid, position' at line 1
    query: SELECT * FROM views_display WHERE vid IN () ORDER BY vid, position in /home/android1/ecafrica.androidshepherd.com/sites/all/modules/views/includes/view.inc on line 1352.
dawehner’s picture

can you check every view, whether its broken?

acephale’s picture

The views in my case are not broken. Everything displays as it should on the front end.

harcher’s picture

I'm not alone.

acephale, I have exactly the same problem. And I can also confirm that the number of the foreach warnings are the same as the number of enabled views. And deleting all views kills all warnings. It's obvious that the query successfully loads all enabled views, but why can't it use the loaded views data?

My views are also not broken and work as expected.

I'm not upgrading to views 2.7 until this issue is resolved.

Drupal 6.14
PHP 5.2.9
mysql 5.0.51a

merlinofchaos’s picture

In #15, when the schema fields is coming up invalid, can you do a dsm() (or equivalent) on $schema and see what is being returned?

If drupal_get_schema() is failing, there's something very strange going on in the database.

merlinofchaos’s picture

Status: Postponed (maintainer needs more info) » Active

Marked http://drupal.org/node/388598 as duplicate.

Turning this to active, though we still need to figure out what is causing drupal_get_schema() to fail.

harcher’s picture

Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new191.22 KB
new555.44 KB
new549.82 KB

I inspected $schema with dsm(), dvm() and firep() (image attached for each).

dsm($schema): returns nothing

dvm($schema): returns bool(false)

firep($schema, 'Schema'): returns the $schema array. Why does this return the array but dsm/dvm doesn't?

These results are after enabling Views module (i.e. ticking the checkbox for Views module) and clicking 'Save configuration'. This ofcourse is where the warnings occur also.

I placed those functions individually on seperate code runs, in views/includes/views.inc:

function load_row($data)
{
    $schema = drupal_get_schema($this->db_table);

    dsm($schema);
    dvm($schema);
    firep($schema, 'Schema');

    // it's complaining here that $schema['fields'] is invalid
    foreach ($schema['fields'] as $field => $info)
    {
        ...
    }
}

I also tested $schema (and $schema['fields']) with the php function is_array(), returns true.

merlinofchaos’s picture

Title: Updating to views 6.x-2.7 displays errors » Disable then enable views displays errors
Status: Postponed (maintainer needs more info) » Active

hga77, first, thanks very much for the extensive debugging you're doing.

The results of your debugging are even weirder. I have no explanation for why 2 of the 3 debug methods would show no schema, but one would. I have no explanation for why the schema is even not present.

The schema files are cached, so the implication is that perhaps something is failing in the schema system. Perhaps the cache is failing (are you using a non-standard caching mechanism) or perhaps you have a module that is trying to load a view so early in the bootstrap that something is causing the schema read to fail? Putting in a vsm_trace() might tell us where the views are being loaded from, though I'm not sure how helpful that information really is. It may be worth something.

At this point, I am tempted to ask for a copy of the database you have and see if I can reproduce this on my local system and do some tracing as well. It is possible that we're looking at a core bug in the schema system, but it is also possible we're looking at some kind of race condition that isn't really a bug.

A complete list of modules that you have active on the system might help as well; this may be caused by some other module interaction, since I"ve never seen this and most of the people I work with have never seen this, yet these things are reported sporadically. It may also be related to install profiles, as in the past people have had issues with Views and install profiles if the order isn't right (and the 'right' order seemed random).

harcher’s picture

merlinofchaos, Thanks for the reply.

I'm not using a non-standard caching mechanism, as far as I'm aware.

About a list of the modules I have, they are on the images I've attached.

I was thinking, maybe this problem occurs after I import the database (i.e. restore, revert the database). Maybe something gets screwd with the db schema, table indexing, collation or something of that sort.

I'm really behind on a few things at the moment but will post anything new I find soon.

merlinofchaos’s picture

Does doing a clear cache make the problem disappear?

splash112’s picture

Had about the same problem.

Finally figured I forgot to put a "return $schema;" at the end of a custom modules "hook_schema".

Still don't know why on earth Views would be involved there anyway...

hass’s picture

Same problem when updating from 2.7 to 2.8. Never used older views versions on this site.

fonant’s picture

Just to say that I got this error too, caused by one of my custom module's hook_schema() function returning an empty value (not an array).

It seems that a non-array result from hook_schema() causes the cached schema array to get corrupted, at which point all sorts of things (not least node_load()) start failing.

McIvan’s picture

Hi guys,
I'm not very familiar with Drupal's "under-the-hood" stuff, so I didn't get some parts of your discussion, but is there an actual solution to this bug/error?

I am just trying to create my first view on almost clean system, following the online tutorials, but keep recieving this error messages.

Thanks in advance

merlinofchaos’s picture

Well, #27 indicates that apparently this can be caused by other modules improperly using hook_schema(). So far that's the only known for sure cause, though there may well be another cause that we have not yet figured out.

d------’s picture

StatusFileSize
new15.53 KB

Hi all,

This error just came up for me too during development. It happened as soon as I enabled mimemail-6.x-1.0-alpha2 (http://drupal.org/project/Mimemail latest D6 release) and Send 6.x-1.0-alpha3 (http://drupal.org/project/Send) modules. Is anyone else using Send & Mimemail module hen they get this error?

If hook_schema() is causing problems with views then maybe someone wants to notify other module developers so they can fix their modules? :)

Meanwhile, any ideas on a quick hack (other than hiding the error warning) that could fix this?

Thanks!

merlinofchaos’s picture

At this point, I am starting to think that there is a core bug with hook_schema() here that's causing this.

Gerald Mengisen’s picture

I can confirm #29's findings:
Just created a new module with the great Module Builder module and had an install file generated. I enabled my module before providing anything to the skeleton install file - content as follows:

// $Id$

/**
 * @file
 * TODO: Enter file description here.
 */

/**
 * Implementation of hook_schema().
 */
function assign_shifts_schema() {

}


/**
 * Implementation of hook_install().
 */
function assign_shifts_install() {

}


/**
 * Implementation of hook_uninstall().
 */
function assign_shifts_uninstall() {

}

-- edit --
The views error disappeared after deactivating my custom module.

woodhand’s picture

I had similar problems, and just confirmed that I forgot to have "return $schema" at the end of schema hook. After I added that line, all warnings are gone.

I suspect there are something incomplete in the schema loading mechanism, which does not check for empty or non-returned schema hook, but let it spread to other areas of code instead.

vegantriathlete’s picture

I have made my way to this thread from taking the link in the 6.2->6.3 WSOD. I am able to upgrade from 6.1 to 6.2 without a problem. But, when I try to upgrade to 6.3, I get the WSOD when I try to run update.php or go into admin/build/modules.

Is there any fix for this? Do I need to search through all the modules installed on the site to see if any is forgetting to do a return $schema? Should I look just in the .install files or should I use grep to search for _schema in the entire sites/all/modules directory?

I really need to get at the ability to turn a field into a link and it seems that was added in 6.3 #349178 by agentrickard: Add generic link handling plus a custom text field. Also automatic trimming.

By the way, when was the "rewrite the output of this field" added? I could use that as well to wrap the field in an anchor tag and make the link myself. I notice in the changelog.txt a reference to #405130 by dereine: Make the output field rewrite a textfield rather than textarea. for 6.4. But, I don't see the rewrite ability in 6.2, just the "link this field to ..." option. Was the rewrite ability also added in 6.3 or am I missing something?

iamjon’s picture

Status: Active » Postponed (maintainer needs more info)

vegantriathlete: i think you are mixing a bunch of different issues please stay on topic.

can anyone confirm that this is still happening on their systems even after upgrading to 6.x.2.11?

If so, as per my converstation with merlinofchaos on irc, we'll make this an unassigned task to try and avoid the crashing, and throw out an error.

chromix’s picture

I'm still seeing the error when I disable and then enable the module and I'm running 6.x-2.12.

    * The configuration options have been saved.
    * Skipping broken view 

    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * warning: Invalid argument supplied for foreach() in sites/all/modules/views/includes/view.inc on line 1747.
    * user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY vid, position' at line 1 query: SELECT * FROM views_display WHERE vid IN () ORDER BY vid, position in sites/all/modules/views/includes/view.inc on line 1369.
merlinofchaos’s picture

As this thread says, so far as we can tell, this is always due to a bug in Drupal core + a module improperly implementing hook_schema(). There is very little that Views can do about this.

iamjon’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Marking as closed based on comment #39