Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.2.0

Bug #19506 Net_LDAP2_Search shiftEntry() errors when no entries were found
Submitted: 2012-07-12 07:01 UTC
From: feystorm Assigned: beni
Status: Closed Package: Net_LDAP2 (version 2.0.12)
PHP Version: 5.2.14 OS: RHEL5
Roadmaps: 2.1.0    
Subscription  


 [2012-07-12 07:01 UTC] feystorm (Patrick Hemmer)
Description: ------------ When Net_LDAP2_Search shiftEntry() is called, if there were no entries returned as a result of the search a PEAR_Error object is returned. From looking at the source, its intended to return a `false` when an error is encountered. However this is failing because the error class is PEAR_Error instead of Net_LDAP2_Error. Additionally shiftEntry() is called by Net_LDAP2_Search::entries(). The entries function doesn't properly check for a `false` return value from shiftEntry(), so even if this were to work properly, entries() would return an array with a single element of `false`. Test script: --------------- $search = $ldap->search('dc=example,dc=com', '(objectClass=noSuchClass)'); print_r($search->entries()); Expected result: ---------------- Array ( ) Actual result: -------------- Array ( [0] => PEAR_Error Object ........ )

Comments

 [2012-07-12 07:06 UTC] feystorm (Patrick Hemmer)
 [2012-07-12 07:07 UTC] feystorm (Patrick Hemmer)
Attached is a patch which fixes the issue with shiftEntry() and entries()
 [2012-07-12 07:22 UTC] feystorm (Patrick Hemmer)
 [2012-07-12 07:23 UTC] feystorm (Patrick Hemmer)
Previous patch was bad. Had an "I'm an idiot" moment. The behavior of the entries() function was correct since the while() loop would have never evaluated. Sorry :-)
 [2013-01-03 14:04 UTC] beni (Benedikt Hallinger)
-Status: Open +Status: Closed -Assigned To: +Assigned To: beni -Roadmap Versions: +Roadmap Versions: 2.1.0
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Thanks again for your contributions!