edit.php:

Newer PHP versions (noticed with 5.6.6) don't include empty fields in
$_POST, which means changing a field to empty was broken.

Change edit.php to make sure all !isset() fields are set to ''.


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1759 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 9 years ago
parent 9f2ae72f08
commit 56b3f11d35

@ -98,10 +98,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach($form_fields as $key => $field) {
if ($field['editable'] && $field['display_in_form']) {
if (!isset($inp_values[$key])) {
if($field['type'] == 'bool') {
$values[$key] = 0; # isset() for unchecked checkboxes is always false
}
# do nothing for other field types
$inp_values[$key] = ''; # newer PHP versions don't include empty fields in $_POST (noticed with PHP 5.6.6)
}
if($field['type'] == 'bool' && $inp_values[$key] == '') {
$inp_values[$key] = 0; # isset() for unchecked checkboxes is always false
} elseif($field['type'] == 'txtl') {
$values[$key] = $inp_values[$key];
$values[$key] = preg_replace ('/\\\r\\\n/', ',', $values[$key]);

Loading…
Cancel
Save