Download & Extend

Fix warning when no User protection defaults are enabled

Project:User protect
Version:6.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

Comments

#1

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

#2

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

Status:fixed» closed (fixed)

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