Skip to content

Commit

Permalink
fix fetching NULL values via fetchColumn()
Browse files Browse the repository at this point in the history
  • Loading branch information
deeky666 committed Nov 5, 2014
1 parent 4af1b64 commit d3f658f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/IBMDB2/DB2Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function fetchColumn($columnIndex = 0)
return false;
}

return isset($row[$columnIndex]) || array_key_exists($columnIndex, $row) ? $row[$columnIndex] : null;
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public function fetchColumn($columnIndex = 0)
return false;
}

return isset($row[$columnIndex]) || array_key_exists($columnIndex, $row) ? $row[$columnIndex] : null;
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public function fetchColumn($columnIndex = 0)
return false;
}

return isset($row[$columnIndex]) || array_key_exists($columnIndex, $row) ? $row[$columnIndex] : null;
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ public function fetch($fetchMode = null)
}

$rows = sqlsrv_fetch_object($this->stmt, $className, $ctorArgs);

return $rows ?: false;
}

Expand Down Expand Up @@ -295,7 +296,7 @@ public function fetchColumn($columnIndex = 0)
return false;
}

return isset($row[$columnIndex]) || array_key_exists($columnIndex, $row) ? $row[$columnIndex] : null;
return isset($row[$columnIndex]) ? $row[$columnIndex] : null;
}

/**
Expand Down

0 comments on commit d3f658f

Please sign in to comment.