Index: patterns/components/user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/patterns/components/user.inc,v
retrieving revision 1.1.2.1.2.10
diff -u -p -r1.1.2.1.2.10 user.inc
--- patterns/components/user.inc	14 May 2009 11:24:45 -0000	1.1.2.1.2.10
+++ patterns/components/user.inc	26 Jul 2009 14:20:39 -0000
@@ -218,7 +218,7 @@ function user_patterns($op, $id = null, 
           unset($data['value']);
 
           foreach($p as $key => $value) {
-            $val = trim($value);
+            $val = trim(trim($value), '\'"');
             if (in_array($val, $permissions)) {
               $perms[$val] = $data['delete'] ? '0' : $val;
             }
@@ -252,8 +252,11 @@ function user_patterns($op, $id = null, 
         if (!$data['overwrite']) {
           $p = db_result(db_query("SELECT perm FROM {permission} WHERE rid = %d", $data['rid']));
           $p = explode(',', $p);
-          $p = array_map('trim', $p);
-          $perms = array_combine($p, $p);
+          $perms = array();
+          if (!empty($p)) {
+            $p = array_map('trim', $p);
+            $perms = array_combine($p, $p);
+          }
           if (!empty($perms)) {
             $data[$data['rid']] = array_merge($perms, $data[$data['rid']]);
           }
