PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Networking » Net_LDAP » Bug #1060

Net_LDAP_Search entries function has an error

Details

Submitted2004-03-24 02:25 UTC
Fromtdennis at trevordennis dot com
Assignedjw
StatusClosed
PackageNet_LDAP
PHP Version4.3.4
OSLinux 2.6
Roadmaps(Not assigned)

Comments

[2004-03-24 02:25 UTC] tdennis at trevordennis dot com

Description:
------------
The the entries function is calling array_push in two locations with an invalid number of parameters.

array_push ( $entry);

I'm using 0.6.5 of Net_LDAP.

I fixed by adding:
$result = array();

And changing array_push to be:
array_push($result,$entry);

And returning the array at the end.
return $result;

Reproduce code:
---------------
require_once("Net/LDAP.php");

$ldap = Net_LDAP::connect( array ( 'host' => 'localhost' ) );
if (Net_LDAP::isError($ldap)) die("not working");

$r = $ldap->search("o=DennisIT,c=CA","(objectClass=organizationalUnit)");
if (Net_LDAP::isError($r) == false) {

$entries = $r->entries();
foreach ($entries as $e) {
echo "Found " . $e->dn() . "<br>";
}
}

Expected result:
----------------
A list of OU's should have been printed.

Actual result:
--------------
Warning: Wrong parameter count for array_push() in /usr/local/lib/php/Net/LDAP/Search.php on line 110

Warning: Wrong parameter count for array_push() in /usr/local/lib/php/Net/LDAP/Search.php on line 116

Warning: Wrong parameter count for array_push() in /usr/local/lib/php/Net/LDAP/Search.php on line 116

[2004-03-24 08:03 UTC] jw at php dot net

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.

Thanks for reporting. Bug is fixed in CVS. Be sure to check out branch NET_LDAP_0_6 when updating your installation. HEAD includes unstable development code right now. New release will follow somewhere in the future.