修正查询条件为NULL的时候参数绑定的错误

This commit is contained in:
thinkphp
2016-09-13 16:33:31 +08:00
parent 888480ca0a
commit 3d868bc2d5
2 changed files with 2 additions and 1 deletions

View File

@@ -326,6 +326,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$value = date($format, $_SERVER['REQUEST_TIME']);
break;
case 'timestamp':
case 'int':
$value = $_SERVER['REQUEST_TIME'];
break;
}

View File

@@ -297,7 +297,7 @@ abstract class Builder
}
}
$bindType = isset($binds[$field]) ? $binds[$field] : PDO::PARAM_STR;
if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) {
if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['NOT NULL', 'NULL', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) {
if (strpos($value, ':') !== 0 || !$this->query->isBind(substr($value, 1))) {
$bindName = $bindName ?: 'where_' . $field;
$this->query->bind($bindName, $value, $bindType);