Bug #19506 [Opn->Csd]: Net_LDAP2_Search shiftEntry() errors when no entries were found
| From: | beni@php.net | Date: | Thu, 03 Jan 2013 09:04:53 +0000 |
| Subject: | Bug #19506 [Opn->Csd]: Net_LDAP2_Search shiftEntry() errors when no entries were found | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9448@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19506&edit=1
ID: 19506
Updated by: beni@php.net
Reported By: pear dot php at feystorm dot net
Summary: Net_LDAP2_Search shiftEntry() errors when no entries
were found
-Status: Open
+Status: Closed
Type: Bug
Package: Net_LDAP2
Operating System: RHEL5
Package Version: 2.0.12
PHP Version: 5.2.14
-Assigned To:
+Assigned To: beni
-Roadmap Versions:
+Roadmap Versions: 2.1.0
New Comment:
-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!
Previous Comments:
------------------------------------------------------------------------
[2012-07-12 03:23:59] feystorm
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 :-)
------------------------------------------------------------------------
[2012-07-12 03:22:44] feystorm
Added #patch
bug:19506;patch:Net_LDAP2-shiftEntry.patch;revision:1342059764;.
------------------------------------------------------------------------
[2012-07-12 03:07:02] feystorm
Attached is a patch which fixes the issue with shiftEntry() and
entries()
------------------------------------------------------------------------
[2012-07-12 03:06:29] feystorm
Added #patch
bug:19506;patch:Net_LDAP2-shiftEntry.patch;revision:1342058789;.
------------------------------------------------------------------------
[2012-07-12 03:01:02] feystorm
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 ........
)
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19506&edit=1