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 |
Jump to:
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.
| Attachment | Size |
|---|---|
| userprotect_defaultvalues.patch | 704 bytes |

#1
Wouldn't replacing the whole loop with
$defaults = array_keys(array_filter($current_defaults));be simpler?#2
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
Automatically closed -- issue fixed for 2 weeks with no activity.