php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: brenocobra at gmail dot com
New email:
PHP Version: OS:

 

 [2017-06-20 20:41 UTC] brenocobra at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.ldap-connect
---

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 "

"ESTE ERRO OCORRE APENAS QUANDO PASSO UMA "LISTA DE IP´S""

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

}else{
// 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.


Patches

bugphp7ldap_connect (last revision 2017-06-20 20:47 UTC by brenocobra at gmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-27 15:37 UTC] mcmic@php.net
-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] mcmic@php.net
(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] heiglandreas@php.net
-Status: Open +Status: Not a bug
 [2017-10-01 06:30 UTC] heiglandreas@php.net
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 3v4l.org hasn't ldap-extension installed)

heiglandreas@172.20.10.4 ~ $ 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@172.20.10.4 ~ $ php -a
Interactive shell

php > var_dump(ldap_connect('ldap://123.234.12.12 ldaps://12.23.34.45'));
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-2025 The PHP Group
All rights reserved.
Last updated: Wed Mar 12 11:01:32 2025 UTC