[support] help narrowing down cause of " array_keys() expects parameter 1 to be array" errors?

Earnie Boyd earnie at users.sourceforge.net
Tue Jun 1 16:13:22 UTC 2010


Ben DJ wrote:
> i'm trying to troubleshoot a Drupal 6.16 site that I did not build --
> so I'm not entirely clear on its install history.
>
> if a new Page node is created -- nothing fancy, just text content -- @
> nav to that page, i frequently see the following errors:
>
>        * warning: array_keys() expects parameter 1 to be array, null
> given in /srv/www/id/0323/includes/common.inc on line 1865.
>        * warning: Invalid argument supplied for foreach() in
> /srv/www/id/0323/includes/common.inc on line 1865.
>
> that's frequently -- but not always.  i haven't been able to determine
> what conditions cause the error to fire.
>
> most often, simply refreshing the page makes the error disappear.
>
> the error's rather generic -- and not reliably reproducible ...
>
> looking @ lineno 1865 in common.inc,
>
> -------------------------
>          foreach ($css as $media =>  $types) {
>            // If CSS preprocessing is off, we still need to output the styles.
>            // Additionally, go through any remaining styles if CSS
> preprocessing is on and output the non-cached ones.
>            foreach ($types as $type =>  $files) {
>              if ($type == 'module') {
>                // Setup theme overrides for module styles.
>                $theme_styles = array();
> 1865:         foreach (array_keys($css[$media]['theme']) as $theme_style) {
>                  $theme_styles[] = basename($theme_style);
>                }
> -------------------------
>
> nothing immediately jumps out at me as to specific cause :-/
>
> other than hunt-n-peck, how can I narrow down what's causing this?
>
> any suggestions appreciated!
>

So you need to determine why $css[$media]['theme'] is not an array or 
most likely not set.  Are your users allowed to choose between differing 
themes?  Is one particular user the one experiencing the problems?

-- 
Earnie
-- http://progw.com
-- http://www.for-my-kids.com


More information about the support mailing list