I've been moving a drupal 4.5 site from one of the default themes to a new theme that introduces phptemplate to the mix (which rocks other than this problem). The new theme appears to be working flawlessly everywhere except when a user with the new theme turned on goes to the themes page. When that happens I get this:
Fatal error: Cannot redeclare _phptemplate_callback() (previously declared in /var/www/drupal-4.5.2/themes/engines/phptemplate/phptemplate.engine:21) in /var/www/drupal-4.5.2/themes/engines/xtemplate/phptemplate/phptemplate.engine on line 21

Now I'm guessing that this is simply a matter of the phptemplate theme engine source being included more than once, so I'm going to take a crack at fixing it myself. But I thought I'd log the bug with the hopes that in a couple minutes I'll be able to post a patch for it (or someone else will).

Thanks guys,
-AC

CommentFileSizeAuthor
#2 system patch.txt693 bytesAnonymous (not verified)

Comments

TDobes’s picture

Category: bug » support

The problem is that you seem to have two copies of the phptemplate engine on your site. One is located in themes/engines/phptemplate/ (this is the correct location), and the other is located in themes/engines/xtemplate/phptemplate/ (this is the incorrect location).

You should delete the themes/engines/xtemplate/phptemplate/ directory and all its contents; Drupal will use the other copy of phptemplate for all phptemplate-based themes and the problem should disappear. This problem does not occur when viewing other pages because it is only on the "themes" page that Drupal scans and inventories all theme engines.

Anonymous’s picture

StatusFileSize
new693 bytes

Ok this one doesn't appear to be phptemplate's fault after all, in fact it seems like this shouldn't ever happen since every include I found used the include_once rather than include. So I wrote a quick hack to the system module to keep it from even trying to load the active theme engine when its generating the theme listings.

Hopefully this system is crazy & no one will ever see this again, but on the off chance someone does I've attached a patch for modules\system.module that fixes the problem.
-AC

Anonymous’s picture

Ok ignore that last patch, I didn't see the response. I can't believe I missed that there was a second directory with it installed, someone must have played around with phptemplate before I really started implementing it. Huge thanks for the quick response, again sorry to waste your time.