FAQ
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@feystorm.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 ........
)

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 3, '13 at 9:04a
activeJan 3, '13 at 9:04a
posts1
users1
websitepear.php.net

1 user in discussion

Beni: 1 post

People

Translate

site design / logo © 2022 Grokbase