[DBAL-257] OCI8Statement::fetchColumn() returns null instead of false Created: 16/Apr/12  Updated: 05/May/12  Resolved: 05/May/12

Status: Resolved
Project: Doctrine DBAL
Component/s: Drivers
Affects Version/s: 2.2.2
Fix Version/s: 2.2.3
Security Level: All

Type: Bug Priority: Major
Reporter: lorenzo zoffoli Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

In
public function fetchColumn($columnIndex = 0)
{
$row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
return $row[$columnIndex];
}

there is no control on oci_fetch_array_() returned value.
When it returns false fetchColumn() returns null instead of false.

Solution:
public function fetchColumn($columnIndex = 0)
{
$row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);
return isset($row[$columnIndex]) ? $row[$columnIndex] : false;
}



 Comments   
Comment by Benjamin Eberlei [ 05/May/12 ]

Fixed

Generated at Wed Apr 16 17:22:23 UTC 2014 using JIRA 5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5.