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.

CommentFileSizeAuthor
userprotect_defaultvalues.patch704 bytesdboulet

Comments

cedarm’s picture

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

hunmonk’s picture

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!

Status: Fixed » Closed (fixed)

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