Error message

Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; GeSHi has a deprecated constructor in require_once() (line 915 of /var/www/

A strange Drupal error while running update.php: Call to undefined function: phptemplate_get_ie_styles()


I've upgraded and updated my Drupal installs a zillion times. A strange error has occurred on the last couple of them which has me scratching my head. I want to share some observations in the hope it will help some others..

Upon applying the updates and running update.php I get this error: Fatal error: Call to undefined function: phptemplate_get_ie_styles() in .../themes/garland/maintenance-page.tpl.php on line 23

This occurred for me starting with the Drupal 6.10 update and now with Drupal 6.11. On is a discussion of this bug but with an unsatisfying conclusion.

The code from themes/garland/maintenance-page.tpl.php is this:

    <!--[if lt IE 7]>
      <?php print phptemplate_get_ie_styles(); ?>

And grepping around reveals phptemplate_get_ie_styles() is defined in themes/garland/template.php.

Clearly template.php isn't being included in the context of executing update.php.

One observation is I just ran this same update on two sites and the behavior did not surface on the second site. The first site used a theme other than Garland, while the second site used the Garland theme. Further on the first site the update.php screens were not properly formatted, but were formatted based on the non-Garland theme being used, while on the second site the update.php screens were formatted with Garland's theme. The latter is expected behavior.

This offers a clue of an possible solution: During update, switch to the Garland theme, then switch back afterwards.

In fact.. There is a larger issue at hand regarding the update process. It's one which it seems in retrospect could potentially plausibly maybe cause problems. But I have done minor version updates a couple dozen times without doing the full update process and not had a problem.

The full Drupal update process is written for major version upgrades such as from Drupal 5 to 6. The process involves disabling all contributed modules, switching to the default theme, performing database backups, switching to maintenance mode, etc. It's laborious and in my experience of having done a few 5 to 6 upgrades, is also error prone. Not every module properly updates itself after switching to the newer version.

A large part of the reason for this laborious process is "The Drop is Always Moving!" which is the Drupal Project's rationalization for not maintaining compatibility from release to release. On every major release they are free to change anything, the database schema, the API's, etc. This is why on major release changes every module is invalidated and has to be ported to the newer release. It makes for extra work in the Drupal community to be continually upgrading modules because the modules break on every release. I suppose it's one way of pruning out deadwood modules if no maintainer shows up to upgrade the module. But it is a cost the community is bearing which could feasibly be put to other uses.

In any case let's get back to the issue of reliably performing an update. I don't recall having ever seen documentation of the correct process to performing a minor Drupal version upgrade. The major Drupal version upgrade (5 to 6) is documented above, but what about a 6.6 to 6.7 upgrade? In this case I'm doing 6.10 to 6.11.

Turns out there is documentation: HowTo: Updating Drupal 6.x to newer minor version. They recommend an abbreviated form of the major version upgrade. It would still involve switching the theme to Garland, disabling all non-core modules, etc. Sheesh, what a load of work! And I swear I've done a minor version upgrade a couple dozen times or more (since Drupal 4.6) without doing all that.

It's clear from the discussion in help upgrading from 6.10 to 6.11, preserving stuff that I'm not the only one who follows a minor update practice of simply dropping the updated files over the existing installation and running update.php.