Updating

An unrecoverable error has occurred. You can find the error message below. It is advised to copy it to the clipboard for reference.
Please continue to the error page
An error occurred. http://smile4me.x24hr.com/drupal/update.php?id=30&op=do <br /> <b>Fatal error</b>: Cannot redeclare phptemplate_body_class() (previously declared in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\themes\garland\template.php:9) in <b>C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\themes\illusionz\template.php</b> on line <b>25</b><br /> 

was told i needed this for calendar but calendar isnt the problem

Comments

KarenS’s picture

Status: Active » Fixed

This is unrelated to either Date or Calendar, neither of which declare phptemplate_body_class(). It sounds like a theme problem, you have two different themes referenced here (garland and illusionz) that are both declaring that, so something is wrong in the way you have themes set up or in the way you've customized it.

Nothing I can do with this. You might ask for theme help in the forums.

chasz’s picture

Status: Fixed » Postponed (maintainer needs more info)

hmm, the only change was the update to date and calendar......

now if the only factors to change are date and calendar, and installing or uninstalling of calendar caused no major errors, then it has to come from the date module??

logic would seem to say so...

i mean you are messing with the theme for all your modules? maybe you called hooks to all themes instead of the default.

But to blow this off as fixed is silly to say mildly

JimSmith’s picture

I also received this error updating to 6.x-2.x-dev (dated Sept-11-2008) after running update.php.

It seems that it is date module that is causing the error because of this additional message:

The update process was aborted prematurely while running update #6001 in date_api.module.

I was updating no other modules at the time of this message. In fact, I was only updating to the dev version because my previous update to rc2 resulted in a "repeats" tab on every page. (Checking the issue queue revealed that this is a known error that's fixed in the dev version.)

Moonshine’s picture

Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Closed (fixed)

@Chasz

KarenS is correct, this has *nothing* to do with the Date module outside of the fact that when you install *any* module Drupal will rebuild its caches (which can expose any number of errors that you have waiting on code you've been working on prior).

My guess is that this illusionz theme you are using is set to be a subtheme of Garland and is trying to re-declare functions with the same name that Garland already has. Which it can't. If you look at the error, it gives you information on the two files causing the overlap problem.

@jns

I can't see how you got the same error as Chasz, unless you are using the same illusionz theme he is. However if you have a full error to report, regarding a Date module update, then lease just start up an new issue and include the full error from the apache/php error log. Thanks!

JimSmith’s picture

@Moonshine
I am not using the same theme and the theme is not a sub-theme of Garland, but I see a similar reference to garland in my error message.

An error occurred. [myurl]/update.php?id=7&op=do
Fatal error: Cannot redeclare phptemplate_body_class() (previously declared in [mypath]/themes/garland/template.php:9) in [mypath]/sites/all/themes/[mytheme]/template.php on line 25

I'm confused, though, how this can be dismissed as not a Date module problem. The error didn't show up in previous updating and only showed up when I updated to the dev version of the Date module. Perhaps you or KarenS can shed some light on that? Thanks.

Moonshine’s picture

Status: Closed (fixed) » Active

@jns

Given that error, I just looked at things further. In a nutshell it's the result of Drupal's update.php being forced to run in Garland and Date's 6001 update clearing the theme registry and re-initializing it. So technically, "yes" the Date update 6001 is involved in the error, as is core's update.php which forces Garland in the mix (creating the problem). I'll reopen this for KarenS to see if there is a safe workaround to avoid clearing out theme information, while still clearing all the views related caches. It may even be possible that update.php has to clear the theme cache already so Date can avoid it all together, she'll know better then me. :)

FWIW, all of this comes after the other (more important) views caches are cleared, so it's really going to end up being a one time error during update.php, and only if you are running a theme other then Garland that has overlapping function names. As it really doesn't cause any harm in the end, I'll leave it as a "normal bug" for her.

Thanks for the report!

JimSmith’s picture

I took a long look at the conflicts with Garland that were in my theme's template.php and figured out how to override them. (The site I'm currently working on is my first 6.x site, so some of this is new to me.)

It appears from my research that a lot of themes just copy Garland's template.php without modifying it, so I think this conflict error will crop up a lot.

Anyway, by removing the conflicts in my theme's template.php I was able to successfully run update.php without errors. And that's something that should be noted, because you can't update the schema without eliminating the error.

Thanks for your help and explanation!

Moonshine’s picture

@jns

No problem. Since you're working on d6 theming, and function naming is relevant here, there is one change coming with Drupal 6.5 you may want to know about:

http://drupal.org/node/252430

So once Drupal 6.5 is released, themes will no longer need to use (or should use) the phptemplate_ namespace for their functions. All themes will be able to just use their own name to prefix all their functions, and sub-themes will all override properly, and problems like this will be avoided. :)

KarenS’s picture

Just to link the issues together, clearing the theme was an effort to fix #303999: Get calendar working with new Views API because the new Views API added new themes that needed to be enabled. I'm going to think about that update, maybe I should just leave the theme registry alone. But if I do and you don't realize it needs to be cleared, the new themes won't work.

KarenS’s picture

Status: Active » Fixed

OK, the problem occurs if you use any theme other than Garland that declares php_template_body_class() since update.php uses the Garland theme and re-declares that class. The fix at http://drupal.org/node/303999#comment-1000257 took care of this problem, so I'm committing it.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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