From d409477b42e507adc8eb246a19a739ac59bb5bbe Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 27 Dec 2016 15:49:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=8F=82=E6=95=B0=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E6=94=AF=E6=8C=81=E4=B8=AD=E6=96=87=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/db/Builder.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index 24ff06ff..51b7a871 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -317,6 +317,11 @@ abstract class Builder } } $bindName = $bindName ?: 'where_' . str_replace('.', '_', $field); + if (preg_match('/\W/', $bindName)) { + // 处理带非单词字符的字段名 + $bindName = md5($bindName); + } + $bindType = isset($binds[$field]) ? $binds[$field] : PDO::PARAM_STR; if (is_scalar($value) && array_key_exists($field, $binds) && !in_array($exp, ['EXP', 'NOT NULL', 'NULL', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN']) && strpos($exp, 'TIME') === false) { if (strpos($value, ':') !== 0 || !$this->query->isBind(substr($value, 1))) {