Fix warning when no User protection defaults are enabled

dboulet - February 3, 2009 - 21:04
Project:User Protect
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I was getting this error at admin/user/userprotect/protection_defaults:

warning: Invalid argument supplied for foreach() in /includes/form.inc on line 1195.

The problem is that if no options on the form are checked, the returned default value is empty. The attached patch assures that the default value is always an array.

AttachmentSize
userprotect_defaultvalues.patch704 bytes

#1

cedarm - July 11, 2009 - 00:44

Wouldn't replacing the whole loop with $defaults = array_keys(array_filter($current_defaults)); be simpler?

#2

hunmonk - July 12, 2009 - 15:17
Title:Invalid default values in protection defaults form» Fix warning when no User protection defaults are enabled
Status:needs review» fixed

cedarm's fix in #1 is more elegant, so i've committed that to 5.x-1.x-dev and 6.x-1.x-dev.

thanks!

#3

System Message - July 26, 2009 - 15:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.