Skip to content


DDC-925: Breaks with Fixing Identification Variables and SQL Walkers - 2 #5454

doctrinebot opened this Issue · 3 comments

1 participant


Jira issue originally created by user gektor:

Here is a part from the file with bug code.

// Fix order of identification variables.
// They have to appear in the select clause in the same order as the
// declarations (from ... x join ... y join ... z ...) appear in the query
// as the hydration process relies on that order for proper operation.
if ( count($this->_identVariableExpressions) > 1) {
  foreach ($this->_queryComponents as $dqlAlias => $qComp) {
    if (isset($this->_identVariableExpressions[$dqlAlias])) {
      $expr = $this->_identVariableExpressions[$dqlAlias];
      $key = array_search($expr, $AST->selectClause->selectExpressions);
      $AST->selectClause->selectExpressions[] = $expr;

Bug details

$key = array_search($expr, $AST->selectClause->selectExpressions);

When array_search function return false (no match).
Then on the next line wrong array element deleted, because (int) false = 0


Comment created by @beberlei:

Add test, this issue does not appear anymore with the fix for DDC-915.


Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added this to the 2.0-RC2 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.