From 9f9ae8a9fd655500a47ab499a5a43347db51fef7 Mon Sep 17 00:00:00 2001 From: Eric Jiang Date: Thu, 19 May 2016 01:56:20 -0700 Subject: [PATCH] Ignore final hyphen in column name when requoting An expression like "Foo"."bar"->'prop' should not be re-quoted as "Foo"."bar-">'prop'. Bare columns cannot include hyphens in most DBs anyways. --- lib/Cake/Model/Datasource/DboSource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 14be37c4b34..bcc6c05fed9 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -2884,7 +2884,7 @@ protected function _quoteFields($conditions) { // Remove quotes and requote all the Model.field names. $conditions = str_replace(array($start, $end), '', $conditions); $conditions = preg_replace_callback( - '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_][a-z0-9\\-_]*\\.[a-z0-9_][a-z0-9_\\-]*)/i', + '/(?:[\'\"][^\'\"\\\]*(?:\\\.[^\'\"\\\]*)*[\'\"])|([a-z0-9_][a-z0-9\\-_]*\\.[a-z0-9_][a-z0-9_\\-]*[a-z0-9_])/i', array(&$this, '_quoteMatchedField'), $conditions );