Zend Framework

fetchAll using column number could return unexpected result set

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.8.0
  • Fix Version/s: 1.8.3
  • Component/s: Zend_Db
  • Labels:
    None

Description

If you are using fetchAll $col parameter and your raw result set has a value like "NULL" or false fetchAll's while condition stops processing the result set.

Example:
array(1000) {
[0]=>
array(1) { [0]=> string(8) "10045849" }
...
[18]=>
array(1) { [0]=> string(8) "10045867" }
[19]=>
array(1) { [0]=> NULL }
[20]=>
array(1) { [0]=> string(8) "10045869" }
...

If you call fetchAll(Zend_Db::FETCH_NUM, 0) you will get 19 rows back, instead of the expected 1000.

Zend_Db_Statement:328 - while ($val = $this->fetchColumn($col)) {

Issue Links

Activity

Hide
Tamas Kozak added a comment -

Possible fix:

while (false !== ($val = $this->fetchColumn($col))) {

Show
Tamas Kozak added a comment - Possible fix: while (false !== ($val = $this->fetchColumn($col))) {
Hide
Satoru Yoshida added a comment -

It duplicates ZF-2112.

Show
Satoru Yoshida added a comment - It duplicates ZF-2112.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: