Permalink
Browse files

Remove parenthesis from table alias when trying to update the alias n…

…ame in Doctrine_Query::getLimitSubquery(), fix DC-645
  • Loading branch information...
1 parent 475cd29 commit 1ccee085f49ab0be17eeb098714d266564d39e8c @jagalan jagalan committed with jwage Sep 2, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Doctrine/Query.php
View
@@ -1519,8 +1519,10 @@ public function getLimitSubquery()
$part = str_replace(array('"', "'", '`'), "", $part);
- if ($this->hasSqlTableAlias($part)) {
- $parts[$k] = $this->_conn->quoteIdentifier($this->generateNewSqlTableAlias($part));
+ // Fix DC-645, Table aliases ending with ')' where not replaced properly
+ preg_match('/^(\(?)(.*?)(\)?)$/', $part, $matches);
+ if ($this->hasSqlTableAlias($matches[2])) {
+ $parts[$k] = $matches[1].$this->_conn->quoteIdentifier($this->generateNewSqlTableAlias($matches[2])).$matches[3];
continue;
}

0 comments on commit 1ccee08

Please sign in to comment.