Have to use === because apparently null == NOW() according to php.

pull/3202/head
Isaac Connor 2021-03-22 12:59:18 -04:00
parent b5f64f1c69
commit 3fdd2bff7f
1 changed files with 1 additions and 1 deletions

View File

@ -351,7 +351,7 @@ class ZM_Object {
$sql = 'INSERT INTO `'.$table.
'` ('.implode(', ', array_map(function($field) {return '`'.$field.'`';}, $fields)).
') VALUES ('.
implode(', ', array_map(function($field){return $this->$field() == 'NOW()' ? 'NOW()' : '?';}, $fields)).')';
implode(', ', array_map(function($field){return (($this->$field() === 'NOW()') ? 'NOW()' : '?');}, $fields)).')';
# For some reason comparing 0 to 'NOW()' returns false; So we do this.
$filtered = array_filter($fields, function($field){ return ( (!$this->$field()) or ($this->$field() != 'NOW()'));});