Explorar o código

Since multiple select and checkbox widgets may not appear in the post, make sure empty values are pushed into the object's new value slot when saving

pdontthink %!s(int64=17) %!d(string=hai) anos
pai
achega
94a08b0471
Modificáronse 1 ficheiros con 9 adicións e 0 borrados
  1. 9 0
      functions/options.php

+ 9 - 0
functions/options.php

@@ -795,6 +795,15 @@ function save_option($option) {
     else
     else
         setPref($data_dir, $username, $option->name, $option->new_value);
         setPref($data_dir, $username, $option->name, $option->new_value);
 
 
+
+    // if a checkbox or multi select is zeroed/cleared out, it
+    // needs to have an empty value pushed into its "new_value" slot
+    //
+    if (($option->type == SMOPT_TYPE_STRLIST_MULTI
+      || $option->type == SMOPT_TYPE_BOOLEAN_CHECKBOX)
+     && is_null($option->new_value))
+        $option->new_value = '';
+
 }
 }
 
 
 /**
 /**