notice: Undefined variable: form_values in /var/www/www.astrocalc.com/htdocs/sites/all/modules/switchtheme/switchtheme.module on line 151.

a review with coder module shows:

switchtheme.module

    *
      severity: critical Line 151: use $form_state['values'] instead, which is where the values are stored after a submit

          variable_set('theme_default', $form_values['custom_theme']);

CommentFileSizeAuthor
#3 switchtheme.patch758 bytessun
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

yettyn’s picture

and the fix:

changing variable_set('theme_default', $form_values['custom_theme']);

to

variable_set('theme_default', $form_state['values']['custom_theme']);
fixes it ;-)

yettyn’s picture

Status: Active » Needs review
sun’s picture

Title: Undefined variable: form_values » Do not switch a site's default theme
FileSize
758 bytes

IMHO, SwitchTheme should never ever allow users to switch the default theme of a site. This happens exactly in this line.

Instead of fixing this bug, I'd propose to remove the line completely.
The same change is already incorporated in the the patch in #185254: Themes don't switch for anonymous users.

sun’s picture

Status: Needs review » Closed (duplicate)