ZF-8947: Zend DB Select Limit Not Executing Properly

Issue Type: Bug Created: 2010-01-26T20:27:45.000+0000 Last Updated: 2012-05-30T12:54:43.000+0000 Status: Closed Fix version(s): Reporter: Cliburn M. Solano (clybs) Assignee: Ralph Schindler (ralph) Tags: - Zend_Db_Select

Related issues: - ZF-9796



If you specify a DB table then use select statement with an order and limit clause, the output for the limit range is wrong.

$nUserId = 123; $select = $this->_table->select(); $select->where('user_id = ?', $nUserId) ->order('createddate DESC') ->limit(0, 200);

print $select;

// SELECT myRecords.* FROM myRecords WHERE (user_id = '123') // ORDER BY createddate DESC LIMIT 2147483647 OFFSET 2

The limit is supposed to be 0 not 2147483647

Regards, Cliburn M. Solano


Posted by Dan Johansson (datasage) on 2011-12-30T20:33:33.000+0000

I just ran into this bug too, in my quick test, order does not seem to matter. It seems to be related to building a query off of Zend_Db_Table though. I am using zf 1.11.11.

Posted by Dan Johansson (datasage) on 2011-12-30T20:34:48.000+0000

It also only occurs if the first argument is 0. Set the argument to 1 and it behaves as expected.

Posted by Dan Johansson (datasage) on 2011-12-30T20:37:14.000+0000

Maybe i should reread the documentation first. The argument order is opposite of what is expected in mysql. This is not a bug.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.