Do not switch a site's default theme

yettyn - January 27, 2008 - 10:10
Project:Switchtheme
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:duplicate
Description

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']);

#1

yettyn - January 27, 2008 - 10:28

and the fix:

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

to

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

#2

yettyn - January 27, 2008 - 10:28
Status:active» patch (code needs review)

#3

sun - April 13, 2008 - 19:52
Title:Undefined variable: form_values» Do not switch a site's default theme

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.

AttachmentSize
switchtheme.patch758 bytes

#4

sun - April 17, 2008 - 14:49
Status:patch (code needs review)» duplicate

Marking as duplicate of #247348: Switchtheme switches the default theme not the users'

 
 

Drupal is a registered trademark of Dries Buytaert.