Whenever I run update.php, I get the warning for views. I am using 21-Jun-2011 Views3-dev version.

Warning message is:
warning: Invalid argument supplied for foreach() in E:\docroot\sites\all\modules\views\views.module on line 117.

Any idea what could be the problem?

Thanks.

Comments

dawehner’s picture

Do you have any idea how to reproduce the bug on a fresh system?

LetUsBePrecise’s picture

Not sure how to reproduce the issue. Earlier, I used to get the warning message at line 87. After putting this new version, warning message showed at line 117.

michaelfavia’s picture

Reproduced locally as well upon migration from old views dev branch to most recent via drush make/aegir. Researching.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Update status because that's really will be hard to fix if there is noone which ables to reproduce it.

LetUsBePrecise’s picture

I can setup team viewer session or skype desktop sharing session for you if you want to see it on my local system.

tbudz’s picture

I can verify this issue, I have the same thing going on

paulgemini’s picture

Status: Postponed (maintainer needs more info) » Active

I have this issue as well. Just upgraded from 2.x to 3.x. Uninstalled 2.x completely and then installed 3.x.

warning: Invalid argument supplied for foreach() in C:\Users\Paul\Sites\acquia-drupal4\sites\all\modules\views\views.module on line 117.

With three people experiencing it, I'm moving this to active.

paulgemini’s picture

Ok here's line 117:
foreach ($def['additional themes'] as $theme => $theme_type) {
and here's the code surrounding line 117:

 // Register theme functions for all style plugins
  foreach ($plugins as $type => $info) {
    foreach ($info as $plugin => $def) {
      if (isset($def['theme'])) {
        $hooks[$def['theme']] = array(
          'pattern' => $def['theme'] . '__',
          'file' => $def['theme file'],
          'path' => $def['theme path'],
          'arguments' => $arguments[$type],
        );

        $include = './' . $def['theme path'] . '/' . $def['theme file'];
        if (file_exists($include)) {
          require_once $include;
        }

        if (!function_exists('theme_' . $def['theme'])) {
          $hooks[$def['theme']]['template'] = views_css_safe($def['theme']);
        }
      }
      if (isset($def['additional themes'])) {
        foreach ($def['additional themes'] as $theme => $theme_type) {
          if (empty($theme_type)) {
            $theme = $theme_type;
            $theme_type = $type;
          }

          $hooks[$theme] = array(
            'pattern' => $theme . '__',
            'file' => $def['theme file'],
            'path' => $def['theme path'],
            'arguments' => $arguments[$theme_type],
          );

          if (!function_exists('theme_' . $theme)) {
            $hooks[$theme]['template'] = views_css_safe($theme);
          }
        }
      }
    }
  }

So...yeah. I know foreach spits this error when it's not given an array. Beyond that, I'm stumped.

dawehner’s picture

So what is 'additional themes' here for you? It's not an array?
This can be fixed easy, but the question is what defines it here not as an array, because this seems to be a bug somewhere else, right?

paulgemini’s picture

How should I determine that? Should I stick a echo statement and just see for myself?

merlinofchaos’s picture

Easiest to use devel.module and dsm() but yes; the problem is likely a module that has bad additional themes data or something, and we need to identify which one that is.

paulgemini’s picture

Ok the error has gone away. ARG! I mean - that's a good thing, but now I can't figure out which module it was. I deactivated a few Ajax-related modules and my acquia search/apache solr modules, but I kind of doubt that's what it was...but who knows?

If (and/or when) it comes back, I'll figure out which module is supplying the bad variable. Thanks for your help!

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

Ok, moving to NMI; when you figure out more, add the info and set back to active. Or eventually Bug Squad will close this if too much time goes by. :)

ckng’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)

I traced mine to Apache Solr Views, note that its tarball is outdated, get from the git repo, the fix is already committed.

Do a dpm($def) to see what you get, if it is not Apache Solr Views.

duplicate of #449190: Enable searching by Views arguments, comment #20 to be exact.

LetUsBePrecise’s picture

Status: Closed (duplicate) » Active

I did dpm($def) and it gave me following output.
apachesolr_views_handler_argument_search

I looked for the solution #449190: Enable searching by Views arguments and this fix is already in my environment.

Not sure what to do here? May be Gurus can suggest something here. Thanks.

dawehner’s picture

Apply the patch in the other issue or update apachesolr_views.
This seems to fix the issue for ckng

ckng’s picture

Update to #14
The git head of Apache Solr Views seems to be in a wonky mode - #1244594: GIT trees out of sync (master and 6.x-1.x-dev) results in feature loss.
Use the tarball + #449190: Enable searching by Views arguments patch #21, solved this warning

kars-t’s picture

Status: Active » Fixed

Hi

I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.

Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.

Status: Fixed » Closed (fixed)

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