ZF-8262: Zend_Ldap_Collection fails to check constraints, fails to return first result with current without seeking

Issue Type: Bug Created: 2009-11-09T13:03:39.000+0000 Last Updated: 2009-11-10T04:01:43.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Michael Croes (mycroes) Assignee: Stefan Gehrig (sgehrig) Tags: - Zend_Ldap

Related issues: Attachments:


Zend_Ldap_Collection has a protected var _currentNumber that defaults to -1. Calling current() on a fresh Zend_Ldap_Collection returned by a search will result in Zend_Ldap_Collection searching for index -1 in an array that should be indexed with positive numbers. This then falls through to Zend_Ldap_Collection_Default where a similar error is made, all in all resulting in the inability to call current() without seeking first. There is a function getFirst(), however I would expect current() to return either NULL if no result exists (as in Zend_Db_Table_Rowset_Abstract) or the first result if I do not seek.


Posted by Stefan Gehrig (sgehrig) on 2009-11-10T04:01:42.000+0000

Fixed in trunk (r18921)

Removed dependency on calling Zend_Ldap_Collection::rewind() before using Zend_Ldap_Collection::current() and/or Zend_Ldap_Collection::key(). Zend_Ldap_Collection::rewind() will be called internally if iteration has not been started yet.

Added Zend_Ldap_Collection::getInnerIterator() to return the underlying Zend_Ldap_Collection_Iterator_Default.

Added Zend_Ldap_Collection::dn() to accompany Zend_Ldap_Collection::key(). The latter returns the numerical index of the current result item within the result set, the former returns its DN.

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.