Undefined variable in Zend_Db_Select

4 messages Options
Embed this post
Permalink
Luiz Vitor

Undefined variable in Zend_Db_Select

Reply Threaded More More options
Print post
Permalink
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 828

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 798, inside an `if` statement, but is used outside it, on line 828.

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

This is a bug or this is the intended behaviour, and I´m using the component in a subverted way?

Thanks in advance.

tfk

Re: Undefined variable in Zend_Db_Select

Reply Threaded More More options
Print post
Permalink
Hey Luiz,

of course this is a bug, did you report it too? :-) [hint, hint]

But before you do, please double-check the bug is still in 1.9.5, and
if it is, please report it ASAP.

Cheers,
Till

On Fri, Oct 30, 2009 at 11:17 AM, Luiz Vitor <[hidden email]> wrote:

> 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 828
>
> 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
> 798, inside an `if` statement, but is used outside it, on line 828.
>
> Moving the declaration to just outside the `if` (line 789) corrects the
> problem, and all unit tests still pass.
>
> This is a bug or this is the intended behaviour, and I´m using the component
> in a subverted way?
>
> Thanks in advance.
>
>
Luiz Vitor

Re: Undefined variable in Zend_Db_Select

Reply Threaded More More options
Print post
Permalink
I didn´t up to now: ZF-8190.

I always try to post in the lists first, just to be sure that I´m not doing anything wrong :)

Thanks for you help.

On Fri, Oct 30, 2009 at 10:33 AM, till <[hidden email]> wrote:
Hey Luiz,

of course this is a bug, did you report it too? :-) [hint, hint]

But before you do, please double-check the bug is still in 1.9.5, and
if it is, please report it ASAP.

Cheers,
Till

On Fri, Oct 30, 2009 at 11:17 AM, Luiz Vitor <[hidden email]> wrote:
> 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 828
>
> 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
> 798, inside an `if` statement, but is used outside it, on line 828.
>
> Moving the declaration to just outside the `if` (line 789) corrects the
> problem, and all unit tests still pass.
>
> This is a bug or this is the intended behaviour, and I´m using the component
> in a subverted way?
>
> Thanks in advance.
>
>

Ralph Schindler-2

Re: Undefined variable in Zend_Db_Select

Reply Threaded More More options
Print post
Permalink
This will make its way into ZF 1.9.6 (or 1.10) whichever comes first.

-ralph

Luiz Vitor wrote:

> I didn´t up to now: ZF-8190.
>
> I always try to post in the lists first, just to be sure that I´m not
> doing anything wrong :)
>
> Thanks for you help.
>
> On Fri, Oct 30, 2009 at 10:33 AM, till <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Hey Luiz,
>
>     of course this is a bug, did you report it too? :-) [hint, hint]
>
>     But before you do, please double-check the bug is still in 1.9.5, and
>     if it is, please report it ASAP.
>
>     Cheers,
>     Till
>
>     On Fri, Oct 30, 2009 at 11:17 AM, Luiz Vitor <[hidden email]
>     <mailto:[hidden email]>> wrote:
>      > 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
>     <http://vilagenet.com.br/library/Zend/Db/Select.php> on line 828
>      >
>      > 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
>      > 798, inside an `if` statement, but is used outside it, on line 828.
>      >
>      > Moving the declaration to just outside the `if` (line 789)
>     corrects the
>      > problem, and all unit tests still pass.
>      >
>      > This is a bug or this is the intended behaviour, and I´m using
>     the component
>      > in a subverted way?
>      >
>      > Thanks in advance.
>      >
>      >
>
>