Changing the url to reach the theme settings for a theme which isn't loaded/does not exist does not give a proper error message.

The expected behaviour would be to get a message similar to "The theme 'foo' does not exist.". Instead a list of cryptic error messages are printed on screen. See attached screenshot for example.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mr.baileys’s picture

Version: 6.4 » 7.x-dev
Status: Active » Needs review
FileSize
674 bytes

Same happens in 7.x-dev. Attached is an attempt to improve the situation.

Right now, system.module sets up an URL for the gobal settings (build/themes/settings) and one URL for each of the installed themes (build/themes/settings/<key>). Both use the same handler function, and in the case of the theme-specific settings the key is passed as a second argument.

In case the theme does not exist, none of the registered specific URLs are used, and the system falls back to the global settings URL (although still passing the invalid key).

Patch attached just forces a blank key to be passed to the handler in case the theme does not exist. Upshot is no more ugly error messages, drawback is that the user will get the global settings page instead of an error message. Since a) the user is hacking away at the URLs anyway, and b) this seems to be more in line with the set up of the menu links, I think this is an acceptable.

If the above solution is not acceptable, maybe we should return a "page not found"?

Dave Reid’s picture

Status: Needs review » Needs work

The last submitted patch failed testing.

mr.baileys’s picture

Status: Needs work » Needs review

re-test.

cburschka’s picture

Status: Needs review » Needs work

If you visit admin/buuild or admin/settings/ddsdjf, you will also see the parent page. This approach is okay.

Not sure about the '' string though. NULL seems more appropriate...

cburschka’s picture

Status: Needs work » Reviewed & tested by the community

Edit: Oops, system_theme_settings has a signature that specifies ''.

In that case, the argument should match the signature. Fine.

Dries’s picture

I'm wondering if it is necessary to install a URL handler/router for each of the installed themes. In other areas of Drupal we would install one generic handler that handles all themes, and then have a drupal_not_found() when an invalid parameter is passed in. It feels like we can potentially do a better clean-up, but I have not investigated that deeply. I think it is worth investigating though.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Yeah, I agree with that.

It looks like taxonomy_term_page() might serve as a model for this. Wow, I never thought I'd say anything in taxonomy module could serve as a model for anything. ;)

Tor Arne Thune’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7

Still a valid issue after the release of 7.0. Moving to 8.x.

mr.baileys’s picture

Version: 8.x-dev » 7.x-dev
Issue tags: -Needs backport to D5, -Needs backport to D7

Setting back to 7.x-dev: bugs are always fixed in HEAD and then backported. As long as the D8 branch hasn't opened, bugs get fixed in 7.x-dev...

mr.baileys’s picture

Assigned: Unassigned » mr.baileys

Assigning to self to take a look at later.

Tor Arne Thune’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7

Any news on this?

Tor Arne Thune’s picture

Status: Needs work » Needs review
FileSize
968 bytes

How about this.

mr.baileys’s picture

Assigned: mr.baileys » Unassigned
aspilicious’s picture

Status: Needs review » Reviewed & tested by the community

Looks good actually....

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Looks like this would be easy to test too...

rszrama’s picture

Status: Needs work » Needs review
FileSize
1.06 KB
68.13 KB

The issue itself was fixed somewhere else, but as far as I could tell it never got tests. Patch attached adds a couple. Anyone know if there's an existing active issue to address the presence of help text on a 404 page?

star-szr’s picture

Status: Needs review » Needs work
Issue tags: +Novice, +Needs reroll

Needs a reroll.

star-szr’s picture

I wasn't able to find an issue for the help text on the 404 page so I created #2073121: Help text from hook_help() is displayed on 404/403 pages.

porchlight’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
1.03 KB

Patch re-rolled.

dasrajarshi’s picture

sun’s picture

This did not throw an error in the past, because all themes were loaded at all times.

With the fix of the parent issue, only test coverage is needed for D8.

star-szr’s picture

Issue tags: +Needs backport to D7

Tagging for backport so we don't forget about it.

star-szr’s picture

Status: Needs review » Reviewed & tested by the community

Tests look pretty good to me and the patch still applies.

catch’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Not convinced this is backportable. I thought you could have disabled themes but still set them to active programmatically in 7.x

Committed/pushed to 8.x, moving back to D7 in case I got that wrong...

  • Commit 5c814d1 on 8.x by catch:
    Issue #323926 by porchlight, Tor Arne Thune, mr.baileys, rszrama:...
catch’s picture

Version: 8.x-dev » 7.x-dev
star-szr’s picture

I think for D7 the bugfix might just be to make sure the theme exists period rather than caring about enabled/disabled.

  • catch committed 5c814d1 on 8.3.x
    Issue #323926 by porchlight, Tor Arne Thune, mr.baileys, rszrama:...

  • catch committed 5c814d1 on 8.3.x
    Issue #323926 by porchlight, Tor Arne Thune, mr.baileys, rszrama:...

  • catch committed 5c814d1 on 8.4.x
    Issue #323926 by porchlight, Tor Arne Thune, mr.baileys, rszrama:...

  • catch committed 5c814d1 on 8.4.x
    Issue #323926 by porchlight, Tor Arne Thune, mr.baileys, rszrama:...