Skip to content

Commit

Permalink
Ignore final hyphen in column name when requoting
Browse files Browse the repository at this point in the history
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 committed May 19, 2016
1 parent 12c6fd4 commit 9f9ae8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/DboSource.php
Expand Up @@ -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
);
Expand Down

0 comments on commit 9f9ae8a

Please sign in to comment.