|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74788 Cannot use ldap_connect passing a list of IPs
Submitted: 2017-06-20 20:41 UTC Modified: 2017-10-01 06:30 UTC
From: brenocobra at gmail dot com Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 7.0.20 OS: Linux RHEL 7.0
Private report: No CVE-ID: None
 [2017-06-20 20:41 UTC] brenocobra at gmail dot com
From manual page:

No PHP Version 5.3.17 executo o ldap_connect passando uma lista de ip´s de servidores AD e a função identificava o primeiro ativo e a partir deste teste já mando fazer o ldap_bind neste servidor ativo.

No PHP Version 7.0.4 executo o ldap_connect passando uma lista de ip´s de servidores AD e recebo o erro " ldap_connect(): Could not create session handle: Bad parameter to an ldap routine "


Test script:
if ($ds = ldap_connect("IP1 IP2 IP3")){
//Conectou OK em algum dos servidores da lista

// Não foi possível conectar a nenhum servidor de AD

OBS.: em IP1, IP2 e IP3 passo o endereço IP dos respectivos servidores

Expected result:
Era esperado que com este teste (if ($ds = ldap_connect("IP1 IP2 IP3")){) fosse validado o primeiro servidor de AD disponível da lista que foi enviada como acontecia na versão 5.3.17.


0 (last revision 2018-07-19 23:19 UTC) by )

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-27 15:37 UTC]
-Summary: Falha ao executar ldap_connect passando uma lista de servidores +Summary: Cannot use ldap_connect passing a list of IPs
 [2017-09-27 15:37 UTC]
(just translating)
The problem reported is ldap_connect will fail when passed a list of IPs separated by spaces, while this worked with PHP 5.3.

The english documentation for ldap_connect does indeed state that passing a list of URI is possible (but not a list of IPs), so I’ll need to test this.
Quote: "You can also provide multiple LDAP-URIs separated by a space as one string"

There is no test for this in ext/ldap/tests so one should be added anyway as the feature is documented.
Then this may need to be fixed if it is indeed not working.
 [2017-10-01 06:30 UTC]
-Status: Open +Status: Not a bug
 [2017-10-01 06:30 UTC]
The documentation clearly states that a list of URIs can be used. Not a list of IPs! 

This is the result on my local machine (sadly hasn't ldap-extension installed)

heiglandreas@ ~ $ php -v
PHP 7.1.8 (cli) (built: Aug  7 2017 15:02:45) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.5, Copyright (c) 1999-2017, by Zend Technologies
heiglandreas@ ~ $ php -a
Interactive shell

php > var_dump(ldap_connect('ldap:// ldaps://'));
php shell code:1:
resource(1) of type (ldap link)

So it works perfectly with LDAP-URIs

Adding a test would be appreciated though ;)
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Jul 19 23:01:25 2018 UTC