Ticket #1272 (closed defect: fixed)
Missing identifier quoting on many-to-many associations query build
Description
Same behavior like in ticket #1262, but this affect queries that use in their body refClass to use joins.
Problem found in Doctrine_Query line 1551 to 1565;
Actual:
$queryPart = $join . $assocTableName . ' ' . $assocAlias;
$queryPart .= ' ON ' . $localAlias
. '.'
. $localTable->getColumnName($localTable->getIdentifier()) // what about composite keys?
. ' = '
. $assocAlias . '.' . $relation->getLocal();
if ($relation->isEqual()) {
// equal nest relation needs additional condition
$queryPart .= ' OR ' . $localAlias
. '.'
. $table->getColumnName($table->getIdentifier())
. ' = '
. $assocAlias . '.' . $relation->getForeign();
}
Patch:
$queryPart = $join . $this->_conn->quoteIdentifier($assocTableName) . ' ' . $this->_conn->quoteIdentifier($assocAlias);
$queryPart .= ' ON '
. $this->_conn->quoteIdentifier($localAlias . '.'
. $localTable->getColumnName($localTable->getIdentifier())) // what about composite keys?
. ' = '
. $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getLocal());
if ($relation->isEqual()) {
// equal nest relation needs additional condition
$queryPart .= ' OR '
. $this->_conn->quoteIdentifier($localAlias . '.'
. $table->getColumnName($table->getIdentifier()))
. ' = '
. $this->_conn->quoteIdentifier($assocAlias . '.' . $relation->getForeign());
}
Attachments
Change History
Note: See
TracTickets for help on using
tickets.