From 56b3f11d3520312eeed79d3d3838e23406956007 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Fri, 20 Mar 2015 00:31:03 +0000 Subject: [PATCH] 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 --- edit.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/edit.php b/edit.php index d864de3b..12cc93fd 100644 --- a/edit.php +++ b/edit.php @@ -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]);