6.16 Update Weirdness

Events happening in the community are now at Drupal community events on www.drupal.org.
thepocketgeek's picture

I recently updated my Drupal install from 6.14. to 6.16. I first updated the files to bring the install to 6.15 and then applied the second set of updates to bring the site current to 6.16. I also updated all of the modules to their current recommended version. I have updated at least three other sites using the same methods and did not have a problem until today.

I am seeing the following message when I log into the admin section:

* warning: Invalid argument supplied for foreach() in /includes/theme.inc on line 485.
* warning: Invalid argument supplied for foreach() in /includes/theme.inc on line 490.

Here are the lines 484 through 494 from the file in question:

484: foreach ($themes as $theme) {
485: foreach ($theme->info['stylesheets'] as $media => $stylesheets) {
486: foreach ($stylesheets as $stylesheet => $path) {
487: $theme->stylesheets[$media][$stylesheet] = $path;
488: }
489: }
490: foreach ($theme->info['scripts'] as $script => $path) {
491: if (file_exists($path)) {
492: $theme->scripts[$script] = $path;
493: }
494: }

From what I understand about the code, its looking at the theme's .info file for stylesheets and scripts? I am not sure what I did to cause the problem. The theme is a simple, custom one I created. I have not had problems with it prior to updating the Drupal version.

Any ideas on what to check?

Comments

Did you run the update.php file after updating?

marcomatic's picture

Whenever you update drupal you can go directly from any 6.x version to 6.16 without having to go through 6.15. Also did you run /update.php after doing the upgrade of the files or modules? Another thing to try is under the site configuration / performance settings click the clear cache button.

I wasn't sure if I could jump

thepocketgeek's picture

I wasn't sure if I could jump from 6.14 straight to 6.16 so I just went the extra step to be sure. I just re-ran the update.php and cleared the cache but I am still getting the error message.

Can I just upload the 6.16 files and see if that would work? Or is this a DB issue?

Try re-uploading your 6.16 files

marcomatic's picture

I would try re-uploading your 6.16 files and also check your php error logs. If need be you could empty any table that begins with cache in your mysql db. Note to empty them but not wipe them from the db and leave their structure in tact.

Seen this too

jcl324's picture

I've seen those errors as well when I've done upgrades before, but when I do like Rightsprocket said, run update.php and clear ALL caches as well as run cron, they eventually went away.

JCL

I just ran cron and the error

thepocketgeek's picture

I just ran cron and the error messages are still there. No joy. Is there away to re apply patches that are run with Update.php?

Be careful

damienmckenna's picture

Re-running updates is not usually a wise idea, it could blow up your site.

Did you clear all of your cache tables? Can you still log in as the admin user? You might try disabling caching entirely (admin/settings/performance) then turn it back on to make everything clear out correctly.

I can log in as the site

thepocketgeek's picture

I can log in as the site admin. I will try clearing out the cache tables.

Okay...

thepocketgeek's picture

There are a few cache tables in the DB. Am I supposed to clear out all of them or specific ones?

cache*

damienmckenna's picture

Truncate all tables that start with 'cache', views_object_cache', 'ctools_object_cache', then check if there are any other tables with 'cache' in the name.

Done. Unfortunately I am

thepocketgeek's picture

Done. Unfortunately I am still getting that error message.

I have a question, when I look at admin/reports/status, where it shows the Drupal version, it is gray as opposed to the green for the rest of the sections on that page. Does that indicate a problem my Drupal version?

The good news is that the error doesn't seem to be causing a problem on the website yet so I still have some time.

thepocketgeek's picture

Okay. So I took a look at the themes I had loaded and it turned out that I had some themes loaded into the themes folder (not the sites/all/themes folder where they SHOULD be...) Once I deleted the offending folders, the error messages cleared up.

Just thought I would post what I did to get rid of the problem in case someone else runs into the issue. Specifically, I had the Zen Theme loaded in both the /themes folder and the sites/all/themes folder. Since I wasn't using the theme at all I deleted them both and POOF! just like that, problem solved.

Specify?

PatrickAlessi's picture

Hi.
I'm having the exact same problem right now...
What was your exact workflow for getting rid of the problem?

If I remember the correctly,

thepocketgeek's picture

If I remember the correctly, I had the Zen Theme loaded in the root Themes folder as well as in the sites/all/themes folder where you would normally place a custom theme. Since I am not really using the Zen theme at all, I simply deleted both Zen folders and the problem went away. I am using NineSixty as my base theme now and it is only in the sites/all/themes folder.

I have also gotten similar messages when I have two copies of the same template.php file loaded. It happened when I first started using NineSixty. I uploaded an empty template.php file to the sites/all/themes/[custom theme name] folder and that fixed it.

I hope that helps.

THANKS

PatrickAlessi's picture

I deletet a unused theme from the site/all/themes directory and the problem was solved.

Sweet!

thepocketgeek's picture

I love it when a plan comes together..

drankin's picture

I run a few Drupal sites and felt that it was time to start upgrading to v6.16 from v5.1.
I started a test run on one of my sites...
I backed up the database and content.
Set the theme to garland and even turned off most of the extra modules other than the core modules.
I then deleted the v5.1 files and copied over the new v6.1 files. I also replaced all of the modules with their newer updates. I did keep the settings.php.

I brought the site up and received the following error in summary:
Warning: Unknown column 'serialized' in 'field list' query: SELECT data, created, headers, expire, serialized FROM cache WHERE cid = 'variables' ...

I followed some tips and did the following:
ALTER TABLE cache
ADD serialized smallint(6) NOT NULL default '0';

I've clear the cache "DELETE FROM TABLE 'cache'
and have even rebuilt the cache

CREATE TABLE IF NOT EXISTS cache (
cid varchar(255) NOT NULL default '',
data longblob,
expire int(11) NOT NULL default '0',
created int(11) NOT NULL default '0',
headers text,
serialized smallint(6) NOT NULL default '0',
PRIMARY KEY (cid),
KEY expire (expire)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

and have also restored the existing database to start the steps over again.

No matter what I end up at the same place with the following message and cannot access anything else.
warning: Invalid argument supplied for foreach() in /home/public_html/site/includes/theme.inc on line 485.
warning: Invalid argument supplied for foreach() in /home/public_html/site/includes/theme.inc on line 490.

The code in theme.inc [484-494] is:

foreach ($themes as $theme) {
foreach ($theme->info['stylesheets'] as $media => $stylesheets) {
foreach ($stylesheets as $stylesheet => $path) {
$theme->stylesheets[$media][$stylesheet] = $path;
}
}
foreach ($theme->info['scripts'] as $script => $path) {
if (file_exists($path)) {
$theme->scripts[$script] = $path;
}
}

I'd appreciate any tips or suggestions...

Thanks

Note:

drankin's picture

I'm trying to still upgrade the site... trying to run upgrade.php
Themes are in there normal location with no special theme selected as mentioned I changed back to a basic theme before proceeding. The site is also in off-line status.

methodical

ultimike's picture

You might be trying to do too much at once. It pays to be very methodical about big updates.

I would suggest that you just try upgrading core first - no contrib modules. Once you copy the 6.16 files over, immediately run update.php. Then, start turning updated modules on, rerunning update.php...

-mike

No such luck...

drankin's picture

If I restore my Drupal v5.1 files the site comes backup fine with no apparent issues.
If I then delete the v5.1 files and load the v6 files, keeping the previous site file (settings.php & v5.1 modules only) in place, I come up with the following error code:

Warning: require_once(a) [function.require-once]: failed to open stream: No such file or directory in /home/public_html/webaddress/includes/bootstrap.inc on line 1063

Fatal error: require_once() [function.require]: Failed opening required 'a' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/webaddress/includes/bootstrap.inc on line 1063

I'm starting to wonder if I should just reinstall Drupal and then try importing my content and users... Haaa!
It's probably something stupid but I just don't get it...

I feel dumb...

drankin's picture

I figured out the answer when someone brought up an obvious point... what is upgrade.php?
I simply shook my head in shame, restored the files, and realized update.php works a lot better and things are going good now...

Thanks...

Heh - that's one mistake you

ultimike's picture

Heh - that's one mistake you never have to worry about making again...

-mike

glass houses

joemoraca's picture

We have all had similar "learning experiences" ;)

Joe Moraca
WebDevGeeks.com

Mike makes a great point. I

thepocketgeek's picture

Mike makes a great point. I think what caused me to run into problems was not paring down the installation to its basic set up, running the update and then turning things on one by one. I never used Drupal 5.x so I have no idea what else you might be running into.
What gave me the error you have is having the same theme in two different folders. I had the Zen Theme loaded in the ROOT themes folder AND the sites/all/themes folder. Since I am not using Zen at all, I simply got rid of it. That solved that problem for me. Setting your theme to Garland is a good first step but I would double check to make sure you don't have a wayward theme folder somewhere.

FWIW, I posted my solution to

achton's picture

FWIW, I posted my solution to the problem here: http://drupal.org/node/860428#comment-3314346

HTH.


See drupal.org/u/achton for profile.

Simple solution...

Just had this problem and fixed it

chaselee's picture

Hi,

My situation is a little odd, so my solution may not apply. I was moving from Drupal 5 to 6 in a closed multi-site environment, so I was doing the migration via a database dump and import.

I had to go to the system table and edit the info field. Somehow the type had been changed from text to varchar (255), which truncated the info being passed so that references to stylesheets and such were left out.

-Chase

forEach() theme.inc errors

Joda The Grey's picture

Hi, I moved my site from Dev to Pre-Live and got these errors on all the pages and my admin pages wouldnt even load, I tried a few of the sughestions like spurious chars in files and nothing fixed it, until... I just reran the mySQL to rebuild the 'system' table and it solved the problem for me.

  • Joda

Florida

Group organizers

Group categories

Florida Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week