Skip to content

Commit

Permalink
Fixed "0" not working properly as a value in columns that accept null…
Browse files Browse the repository at this point in the history
…. Thanks jmason03 on the forums!
  • Loading branch information
timbuckingham committed Jan 12, 2015
1 parent 9257c12 commit 492c126
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/inc/bigtree/auto-modules.php
Expand Up @@ -1458,15 +1458,15 @@ static function sanitizeData($table,$data,$existing_description = false) {

// Sanitize Integers
if ($type == "tinyint" || $type == "smallint" || $type == "mediumint" || $type == "int" || $type == "bigint") {
if ($val !== 0 && !$val && $allow_null == "YES") {
if ($allow_null == "YES" && ($val === null || $val === false || $val === "")) {
$data[$key] = "NULL";
} else {
$data[$key] = intval(str_replace(array(",","$"),"",$val));
}
}
// Sanitize Floats
if ($type == "float" || $type == "double" || $type == "decimal") {
if ($val !== 0 && !$val && $allow_null == "YES") {
if ($allow_null == "YES" && ($val === null || $val === false || $val === "")) {
$data[$key] = "NULL";
} else {
$data[$key] = floatval(str_replace(array(",","$"),"",$val));
Expand Down

0 comments on commit 492c126

Please sign in to comment.