From ecbee822cd8396a33c729c2cb7a74446771dfa74 Mon Sep 17 00:00:00 2001 From: Joey Schulze Date: Tue, 9 Mar 2010 20:10:57 +0100 Subject: [PATCH] *sigh* empty('0') evaluates to true even though the string is not empty. --- ajax/ajax.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ajax/ajax.php b/ajax/ajax.php index f8a62c1..2919669 100644 --- a/ajax/ajax.php +++ b/ajax/ajax.php @@ -90,7 +90,7 @@ function save($mask) "sys_edit = now()"); foreach ($mask['edit'] as $field => $info) { - if ($info['required'] === true && empty($_POST[$field])) + if ($info['required'] === true && !strlen($_POST[$field])) return array('error' => sprintf('Pflichtfeld %s nicht ausgefüllt', $info['name']), 'errormsg' => 'Pflichtfelder nicht ausgefüllt'); @@ -141,7 +141,7 @@ function insert($mask) $values = array("'".pg_escape_string($_SESSION['sys']['login'])."'", 'now()'); foreach ($mask['edit'] as $field => $info) { - if ($info['required'] === true && empty($_POST[$field])) + if ($info['required'] === true && !strlen($_POST[$field])) return array('error' => sprintf('Pflichtfeld %s nicht ausgefüllt', $info['name']), 'errormsg' => 'Pflichtfelder nicht ausgefüllt'); -- 2.20.1