It's also not uncommon to do a website for example.com and name the theme "example" since it's for example.com, and a custom module with site-specific customizations "example" as well. However, doing this causes conflicts. The one we ran into today was with help text, which would spew out:

warning: Missing argument 1 for example_help() in \modules\example.module on line 12.

You can give $section a default value of NULL to get it to stop doing that, but then no help will display anywhere on the site.

This might be a "Well then don't do that!" problem, but it was very confusing trying to track this down so I figured I'd mention this.

Comments

webchick’s picture

Title: Module + Theme named the same causes conflicts » hook_help and theme('help') interfere when module and theme named the same
Version: 4.7.2 » x.y.z
Assigned: Unassigned » webchick
Status: Active » Needs review
StatusFileSize
new2.27 KB

This happened to me again tonight so I looked more into it, and hit a "duh" moment. :P

Of course they can't be named the same; When PHPTemplate encounters a theme('something') call, it first attempts:

current_theme_something()

then

phptemplate_something()

and finally

theme_something()

So when phptemplate.engine is calling theme('help') in a theme called "foo", it's interfering with foo_help in foo.module, which is a help hook.

Attached patch renames theme_help to theme_help_message to stop this from happening.

webchick’s picture

Status: Needs review » Postponed

Talked to drumm... since this is an API change, it won't get in the 5.0 release cycle, so changing status to "postponed" so I can re-roll when HEAD opens up again.

webchick’s picture

Version: x.y.z » 6.x-dev
Status: Postponed » Needs work

I forgot about this again until just tonight. :) Hopefully can get it in pre-code-freeze this time. ;)

keithorama’s picture

This one caught me too.

I agree it's natural to have a theme and module named the same thing.

webchick’s picture

StatusFileSize
new2.89 KB

I've no idea why this isn't working. I must be missing something silly. Any ideas?

dpearcefl’s picture

Is there any interest in this issue?

lars skjærlund’s picture

If this hasn't been solved yet - well, then I was very close to be bitten by it in a few hours.

And if I hadn't been lucky enough to read this before I started, I too would have spend a lot of time trying to figure out what was wrong.

It should really be given priority - it seems to be a very old bug.

Regards,
Lars

mdupont’s picture

Assigned: webchick » Unassigned
Status: Needs work » Closed (won't fix)

theme_help() was removed in D7 so it's a D6 only issue. At this point in D6 lifecycle there won't be an API change. So unfortunately this will stay a "Don't do that" problem under D6.