Zend Framework

Undefined variable in Zend_Db_Select

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.4
  • Fix Version/s: 1.9.6
  • Component/s: Zend_Db_Select
  • Labels:
    None

Description

The changes in Zend_Db_Select in 1.9.4 release started to raise an undefined variable notice:

( ! ) Notice: Undefined variable: lastFromCorrelationName in /data/html/vilagenet.com.br/library/Zend/Db/Select.php on line 840

To reproduce:

$adapter = Zend_Db_Table::getDefaultAdapter();

$select = $adapter->select()
    ->from('sometable', 'id');

$select2 = $adapter->select()
    ->from(null, 'COUNT(*) FROM (' . $select->__toString() . ') AS count');

$result = $adapter->fetchCol($select2);

The variable $lastFromCorrelationName is declared in Zend_Db_Select on line 810, inside an if statement, but is used outside it, on line 840.

Moving the declaration to just outside the if (line 800) corrects the problem, and all unit tests still pass.

Tested in trunk and the bug is still present.

Issue Links

Activity

Hide
Luiz Damim added a comment -

Attaching the patch to solve this issue.

Show
Luiz Damim added a comment - Attaching the patch to solve this issue.
Hide
Satoru Yoshida added a comment -

Solved in SVN r18750(trunk), r18751(1.9branch)

Show
Satoru Yoshida added a comment - Solved in SVN r18750(trunk), r18751(1.9branch)

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: