When sending an UPDATE query, constructed from a POST payload where some elements have as a value a zero-length string, the database engine warns that SET'ing an INT data type column with a string ain't going to happen, and actually uses the best default value for that data type (a zero in the case of an INT data type).
Specifically, CubeCart_inventory has many columns that have DEFAULT NULL. Some columns do accept a zero-length string, others do not.
Suggest:
In database.class.php,
Near line 65, find:
protected $_allowed_exceptions = array('CURRENT_TIMESTAMP', 'NOW()', 'offline_capture', 'NULL');
Change to:
protected $_allowed_exceptions = array('CURRENT_TIMESTAMP', 'NOW()', 'offline_capture', 'NULL', 'DEFAULT');
Near line 848 (CC653) or line 872 (Master as of today), in the `update()` function, find:
$set[] = "`$field` = `$field` {$value[0]} ".$number;
Add after:
} elseif (empty($value) && !is_numeric($value)) {
$set[] = "`$field` = DEFAULT";
Consider, as well, to synchronize the coding of insert() with update().
Code Review: Feature Request:
Regarding #3492...
When sending an UPDATE query, constructed from a POST payload where some elements have as a value a zero-length string, the database engine warns that SET'ing an INT data type column with a string ain't going to happen, and actually uses the best default value for that data type (a zero in the case of an INT data type).
Specifically,
CubeCart_inventory
has many columns that haveDEFAULT NULL
. Some columns do accept a zero-length string, others do not.Suggest: In database.class.php,
Consider, as well, to synchronize the coding of
insert()
withupdate()
.