As the warning reads in the subject there is a bad reference here that needs to be fixed.

Comments

nicholas.alipaz’s picture

Title: warning: Invalid argument supplied for foreach() in /.../sass/sass.module on line 31. » warning: Invalid argument supplied for foreach() in /.../sass/sass.module on line 31. Key 'all' is hardcoded here.

This looks to be due to the hardcoding of 'all' as the key in the foreach. Some themes might declare the stylesheets as
stylesheets[screen][] = "core.css"
stylesheets[screen][] = "icons.css"
stylesheets[screen][] = "style.css"
stylesheets[print][] = "print.css"

Rubik does this actually.

nicholas.alipaz’s picture

I replaced line 31's foreach with this:

  foreach ($theme_info->stylesheets as $type)
  {
    foreach ($type as $stylesheet) {
      $scss = str_replace('.css','.scss',$stylesheet);

      # If we're in development mode clear any CSS files that have a cooresponding SCSS file.
      if (variable_get('sass_development_mode', true) && file_exists($scss))
      {
        if (variable_get('sass_show_development_mode_warning', true))
        {
          drupal_set_message(t('Your SASS / SCSS stylesheets are currently being rebuilt on every request. Ensure you disable <a href="!link">development mode</a> for production sites.', array('!link'=>url('admin/settings/phamlp/sass'))),'warning');
        }

        if (file_exists($stylesheet))
        {
          unlink($stylesheet);
        }
      }

      if (!file_exists($stylesheet) && file_exists($scss))
      {
        file_put_contents($stylesheet, $sass->toCss($scss));
      }
    }
  }

Got rid of the error. I don't know if you need a patch for this, but it is a fairly simple fix. BTW, on a side-note the module does not follow drupal coding standards for whitespace or comments.

nicholas.alipaz’s picture

ah, I guess there is an issue open for the coding standards thing: #1604776: Follow coding standards

ken hawkins’s picture

Issue summary: View changes

This problem also exists in the 7.x version.

If your theme uses 'screen' stylesheets, the will be ignored.

Can be worked around by modifying lines:

@53

  if (file_exists($sassparser_path) && isset($theme_info->stylesheets['screen']) && count($theme_info->stylesheets['screen']) > 0) {

and @62

    foreach ($theme_info->stylesheets['screen'] as $stylesheet) {