From a9bfdcb82ce6da10f9cf9592f9fd58990388335a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Bernigaud?= Date: Mon, 23 Nov 2015 03:08:02 +0100 Subject: [PATCH 1/2] Revert "Using default port in ldap_connect when NULL is passed (this was the behavior prior to 5.6.11)" This reverts commit 391087ed280f86f144ffa5a2b72eeeda3c271743. --- ext/ldap/ldap.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 8b66ba44ca7..64885c7cb73 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -349,9 +349,6 @@ PHP_FUNCTION(ldap_connect) RETURN_FALSE; } #endif - if (!port) { - port = LDAP_PORT; - } if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", LDAPG(num_links)); From ab39f981f822d7f2f41612496c55b4e8b6213be9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Bernigaud?= Date: Mon, 23 Nov 2015 03:08:25 +0100 Subject: [PATCH 2/2] Revert "Added back support for undocummented host:port syntax" This reverts commit 15876e85e59658bfbda3bf0b0c34d56ca503fd2f. --- ext/ldap/ldap.c | 7 +------ ext/ldap/tests/ldap_connect_variation.phpt | 5 ----- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 64885c7cb73..ab663b156be 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -369,12 +369,7 @@ PHP_FUNCTION(ldap_connect) } url = emalloc(urllen); - if (host && (strchr(host, ':') != NULL)) { - /* Legacy support for host:port */ - snprintf( url, urllen, "ldap://%s", host ); - } else { - snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port ); - } + snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port ); } #ifdef LDAP_API_FEATURE_X_OPENLDAP diff --git a/ext/ldap/tests/ldap_connect_variation.phpt b/ext/ldap/tests/ldap_connect_variation.phpt index eaee2615425..09b07e77863 100644 --- a/ext/ldap/tests/ldap_connect_variation.phpt +++ b/ext/ldap/tests/ldap_connect_variation.phpt @@ -28,10 +28,6 @@ var_dump($link); // bad hostname (connect should work, not bind) $link = ldap_connect("nonexistent" . $host); var_dump($link); - -// Legacy host:port syntax -$link = ldap_connect("$host:$port"); -var_dump($link); ?> ===DONE=== --EXPECTF-- @@ -40,5 +36,4 @@ resource(%d) of type (ldap link) resource(%d) of type (ldap link) resource(%d) of type (ldap link) resource(%d) of type (ldap link) -resource(%d) of type (ldap link) ===DONE===