php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63820 Parallel search does not accept array of attribute arrays
Submitted: 2012-12-20 18:44 UTC Modified: 2017-01-09 21:13 UTC
Votes:2
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rr dot rossmann at me dot com Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 5.4.10 OS: OS X
Private report: No CVE-ID: None
 [2012-12-20 18:44 UTC] rr dot rossmann at me dot com
Description:
------------
When doing an ldap parallel search, it is not possible to specify the attributes I want to retrieve per-query, only per operation.

I want to read a set of properties for a read operation of i.e. OU=Computers,DC=example,DC=com and a different set of properties for OU=Users,DC=example,DC=com . I want to do a parallel read operation by combining all the query parameters (links, search bases etc.) into arrays, but I cannot group the attributes arrays as such; I can only provide one array with the attributes, otherwise only DN is returned in the resultset.

Test script:
---------------
$con = ldap_connect( 'example.com' );

ldap_set_option( $con, LDAP_OPT_PROTOCOL_VERSION, 3 );
ldap_set_option( $con, LDAP_OPT_REFERRALS, 0 );

ldap_bind( $con, 'User', 'password' );

// use the same connection for both read queries
$connections = array( $con, $con );

// Read attribs from Computers and Users containers
$dns = array( 'OU=Computers,DC=example,DC=com', 'OU=Users,DC=example,DC=com' );

// Needed for the read operation
$filters = array( '(objectclass=*)', '(objectclass=*)' );

$attribSet1 = array( 'name', 'objectclass' ); // attribs I want from Computers
$attribSet2 = array( 'cn', 'objectcategory' ); // attribs I want from Users

// Combining the attributes like this causes the erroneous behaviour
$getThese = array( $attribSet1 , $attribSet2 );

// Do a parallel read operation
$result_ids = ldap_read( $connections, $dns, $filters, $getThese );

$data0 = ldap_get_entries( $con, $result_ids[0] );
$data1 = ldap_get_entries( $con, $result_ids[1] );

print_r( $data0 ); // Only DN attribute retrieved
print_r( $data1 ); // Only DN attribute retrieved

/*
Doing the read query like this works, but I have to specify the attribute set for the whole operation:
$result_ids = ldap_read( $connections, $dns, $filters, $getThese[0] );
*/

Expected result:
----------------
for print_r( $data0 ); I expect to have these attributes present:
name, objectclass

for print_r( $data1 ); I expect to have these attributes present:
cn, objectcategory

Actual result:
--------------
I get only dn attribute, which is returned for every ldap query

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-12-23 18:04 UTC] felipe@php.net
-Type: Bug +Type: Feature/Change Request
 [2017-01-09 17:10 UTC] heiglandreas@php.net
I'm not really sure what you want to acchieve. ldap_read is a form of ldap_search that only searches the given base_dn. There is no parallel search functionality involved.

You still need to do one search/read after the other. 

As this seems not to be a bug in PHP (and as the targeted PHP-Version is by now unsupported) I'm closing this issue.

Feel free to (re)open.
 [2017-01-09 17:10 UTC] heiglandreas@php.net
-Status: Open +Status: Not a bug
 [2017-01-09 17:10 UTC] heiglandreas@php.net
Forgot to set the status…
 [2017-01-09 21:13 UTC] heiglandreas@php.net
The parallel search only works when you want to search for the same attributes. You want to search for different attributes? you will need to search one after the other...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 16:01:29 2024 UTC