Skip to content
Permalink
Browse files

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.
  • Loading branch information...
Eric Jiang
Eric Jiang committed May 19, 2016
1 parent 12c6fd4 commit 9f9ae8a9fd655500a47ab499a5a43347db51fef7
Showing with 1 addition and 1 deletion.
  1. +1 −1 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
);

0 comments on commit 9f9ae8a

Please sign in to comment.
You can’t perform that action at this time.