I have a site temporarily hosted at http://aai.ehrenwerks.com that is a sub site of a master drupal install that is giving me fits. The site will randomly loose its default template and attached CSS and spew errors. It's a minimally modified Zen sub-template hosted on a Plesk administered server with a stand alone mySQL server on the local network. Errors on the page when the theme breaks are as follows:

* warning: array_map() [function.array-map]: Argument #2 should be an array in /var/www/vhosts/ehrenwerks.com/subdomains/drupal/httpdocs/drupal/modules/system/system.module on line 1015.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/vhosts/ehrenwerks.com/subdomains/drupal/httpdocs/drupal/includes/theme.inc on line 1771.
* warning: Invalid argument supplied for foreach() in /var/www/vhosts/ehrenwerks.com/subdomains/drupal/httpdocs/drupal/includes/theme.inc on line 1771.

Any help or pointers to this mystery muchly appreciated

Steve

Comments

joecanti’s picture

Hi,

Does it behave the same with other contributed themes? Or one of the system themes?

Why is it a temporary hosting? Is it just to play around with ideas or are you going to have a production site there in its place soon?

joe

steve_adams’s picture

This instance is 'temporary' in the respect that I'm going to move it to replace the 'real' domain soon. It's a development site and will be pushed to production as the content is approved.

I was not the first developer to work on this site, and the previous developer's template caused these same symptoms. I rebuilt this one from scratch to try and diagnose the issue. There are very little differences from the default Zen theme...maybe 20 lines of code are present in this sub-theme. No, I do not have similar problems with the default themes.

S

MaT972’s picture

I'm facing the same issue, but the problem seems to be wider than that; let me explain what I've done, maybe it will help you to understand:
- I forked an existing module : http://drupal.org/project/moviedb to fit to my needs;
- I added some fields to this content type using CCK
- When the described bug is triggered, the content type does not appear anymore in http://localhost/admin/content/types
- I have to run http://localhost/update.php to fix it (till the next time the bug appears).

I'm using drupal 6.15.

If you are googling for : drupal 1015 1771 "should be an array"

Any help will be highly appreciated

MaT972’s picture

I forgot to say that I also had to clear drupal's cache to fix it (ie http://localhost/admin/settings/performance )

MaT972’s picture

I see on this post (in french), that the bug may not be related to zen, as the person who reports the problem started with bluemarine.

MaT972’s picture

I realized that:
- broken theme layout is fixed by clearing drupal's cache
- lost content type is fixed by running "update.php"

Each fix can be run on its own.

MaT972’s picture

I suspect that devil devel module is involved in this problem, as I can't reproduce the problem when the module is disabled.
Are you guys using it too ?

steve_adams’s picture

No, I am not using the devel module, nor experiencing any loss of style

steve_adams’s picture

here's a comprehensive group of errors after clearing the cache as you suggested...it DOES NOT fix the issue:

* warning: array_map() [function.array-map]: Argument #2 should be an array in /var/www/vhosts/domain.com/subdomains/drupal/httpdocs/drupal/modules/system/system.module on line 1015.
* warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/vhosts/domain.com/subdomains/drupal/httpdocs/drupal/includes/theme.inc on line 1771.
* warning: Invalid argument supplied for foreach() in /var/www/vhosts/domain.com/subdomains/drupal/httpdocs/drupal/includes/theme.inc on line 1771.

johnphethean’s picture

Hi I'm having the same issue.
Same 3 error messages about theme.inc and system.module. I can't log in ("Access denied, you may need to log in...").
I was using a customised theme based on 'Framework' and have updated to the lastest .info file which is present.
I also tried overriding the default theme using both system.php and the database 'variables' table - no fix.
Have cleared the cache (which was a whopping 50mb or so) via the database (sql query 'TRUNCATE cache' and 'TRUNCATE cache_page') - no fix.
Uploaded the latest 6.15 system files and visited update.php (after changing $update_free_access in settings.php to TRUE). Strangely the updated files didn't register here and no update was available. If I press 'Continue Update' anyway the page hangs.

You've probably checked, but here's the offending lines:
System.module 1015: $list[$theme_key] = array_map('t', $info['regions']);
theme.inc 1771: foreach (array_keys($regions) as $region) {

So must be related to the info file and the regions somehow.

There's another similar post under 'Drupal for Facebook' which has just been closed with 'no fix found'.
I'll keep on at it and let you know if I find anything. Please do likewise!
Good luck

johnphethean’s picture

If it helps, I have a logo file in sites/all/framework which is coming up in the HTML as simply http://logo.png

johnphethean’s picture

Seems to be fixed. I think my main problem was not being able to log in to access the available themes page.
Eventually I went into the DB and found that the 'system' table no longer carried any info on the themes. Luckily I'd backed up the site a few months ago and found the relevant SQL query:

INSERT INTO `drupal1system` VALUES ('themes/bluemarine/bluemarine.info', 'bluemarine', 'theme', 0, 0, 0, -1, 0, 'a:13:{s:4:"name";s:10:"Bluemarine";s:11:"description";s:66:"Table-based multi-column theme with a marine and ash color scheme.";s:7:"version";s:4:"6.13";s:4:"core";s:3:"6.x";s:6:"engine";s:11:"phptemplate";s:7:"project";s:6:"drupal";s:9:"datestamp";s:10:"1246481719";s:7:"regions";a:5:{s:4:"left";s:12:"Left sidebar";s:5:"right";s:13:"Right sidebar";s:7:"content";s:7:"Content";s:6:"header";s:6:"Header";s:6:"footer";s:6:"Footer";}s:8:"features";a:10:{i:0;s:20:"comment_user_picture";i:1;s:7:"favicon";i:2;s:7:"mission";i:3;s:4:"logo";i:4;s:4:"name";i:5;s:17:"node_user_picture";i:6;s:6:"search";i:7;s:6:"slogan";i:8;s:13:"primary_links";i:9;s:15:"secondary_links";}s:11:"stylesheets";a:1:{s:3:"all";a:1:{s:9:"style.css";s:27:"themes/bluemarine/style.css";}}s:7:"scripts";a:1:{s:9:"script.js";s:27:"themes/bluemarine/script.js";}s:10:"screenshot";s:32:"themes/bluemarine/screenshot.png";s:3:"php";s:5:"4.3.5";}', 'themes/engines/phptemplate/phptemplate.engine');
INSERT INTO `drupal1system` VALUES ('sites/all/themes/framework/framework.info', 'framework', 'theme', 1, 0, 0, -1, 0, 'a:13:{s:4:"name";s:9:"Framework";s:11:"description";s:126:"Framework is a blank canvas for theme developers. Use Framework as a starting point to help facilitate your theme development.";s:7:"version";s:7:"6.x-2.4";s:4:"core";s:3:"6.x";s:6:"engine";s:11:"phptemplate";s:11:"stylesheets";a:2:{s:3:"all";a:1:{s:9:"style.css";s:36:"sites/all/themes/framework/style.css";}s:5:"print";a:1:{s:9:"print.css";s:36:"sites/all/themes/framework/print.css";}}s:7:"regions";a:6:{s:4:"left";s:12:"Left sidebar";s:5:"right";s:13:"Right sidebar";s:7:"content";s:7:"Content";s:6:"header";s:6:"Header";s:3:"nav";s:10:"Navigation";s:6:"footer";s:6:"Footer";}s:7:"project";s:9:"framework";s:9:"datestamp";s:10:"1237266627";s:8:"features";a:10:{i:0;s:20:"comment_user_picture";i:1;s:7:"favicon";i:2;s:7:"mission";i:3;s:4:"logo";i:4;s:4:"name";i:5;s:17:"node_user_picture";i:6;s:6:"search";i:7;s:6:"slogan";i:8;s:13:"primary_links";i:9;s:15:"secondary_links";}s:7:"scripts";a:1:{s:9:"script.js";s:36:"sites/all/themes/framework/script.js";}s:10:"screenshot";s:41:"sites/all/themes/framework/screenshot.png";s:3:"php";s:5:"4.3.5";}', 'themes/engines/phptemplate/phptemplate.engine');
INSERT INTO `drupal1system` VALUES ('themes/chameleon/marvin/marvin.info', 'marvin', 'theme', 0, 0, 0, -1, 0, 'a:13:{s:4:"name";s:6:"Marvin";s:11:"description";s:31:"Boxy tabled theme in all grays.";s:7:"regions";a:2:{s:4:"left";s:12:"Left sidebar";s:5:"right";s:13:"Right sidebar";}s:7:"version";s:4:"6.13";s:4:"core";s:3:"6.x";s:10:"base theme";s:9:"chameleon";s:7:"project";s:6:"drupal";s:9:"datestamp";s:10:"1246481719";s:8:"features";a:10:{i:0;s:20:"comment_user_picture";i:1;s:7:"favicon";i:2;s:7:"mission";i:3;s:4:"logo";i:4;s:4:"name";i:5;s:17:"node_user_picture";i:6;s:6:"search";i:7;s:6:"slogan";i:8;s:13:"primary_links";i:9;s:15:"secondary_links";}s:11:"stylesheets";a:1:{s:3:"all";a:1:{s:9:"style.css";s:33:"themes/chameleon/marvin/style.css";}}s:7:"scripts";a:1:{s:9:"script.js";s:33:"themes/chameleon/marvin/script.js";}s:10:"screenshot";s:38:"themes/chameleon/marvin/screenshot.png";s:3:"php";s:5:"4.3.5";}', '');

I executed that, switched off the theme override (and the conf_array hash) in settings.php and it seems to be back to normal. I also removed the region fields from the theme .info file. But why would Drupal have dropped those fields? Strange...

Hope this helps..

MaT972’s picture

I guess you found what really breaks the page. Now time to figure why it happens ...

Anonymous’s picture

here is what i did on this error. i think what it cause was that i activated the theme in the settings.php file as a default before it was "activated" in the admin section. i use the setting.php file cause i do mobile theme switching. so there was the error and broken theme and it did not help to activate it later on. i deleted the theme and went to the admin section for the theme as i figured it might delete the cache and databases.
then install the theme again, go to the admin section first and activate it. now it works for me.

mvpfi’s picture

Fix presented above worked for me, too. I was updating a site (from quite old versions), after which the site was not working for anyone without admin status. As I still was logged in as admin, I was able to navigate to the themes page, where my custom theme had got disabled during the update. All the other themes were disabled, too. I clicked my custom theme back on and everything went back to normal.

sampeckham’s picture

I'm having the same problem with exact same errors, got to this page from the 'Drupal for Facebook' thread that correctly identified it as a theme error.

The trouble is on my set up is when you're not logged in you get these errors, when you are they go away. However, checking the theme page in the admin shows no theme as the default (all the radio boxes are empty) and I can't set any theme (even core ones) as the default - which is what i think is causing the errors.

Every time I select a theme as default and click save it reloads the page with nothing selected.

Tried clearing cache and running update.php with no joy.

Should I try setting a default theme in the database directly and if so what value should I use?

Thanks
Sam

keilo’s picture

I had this problem. The site is in development and I have the only account. Running update.php fixed it. No idea what could possibly cause it, it seems to have appeared out of nowhere. If this issue happens again I'll have to dig the code to see what's causing it.