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.
This commit is contained in:
Eric Jiang 2016-05-19 01:56:20 -07:00
parent 12c6fd4e22
commit 9f9ae8a9fd

View file

@ -2884,7 +2884,7 @@ class DboSource extends DataSource {
// 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
);