1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 02:33:17 +02:00

Added back support for undocummented host:port syntax

This commit is contained in:
Côme Bernigaud
2015-11-16 04:50:12 +01:00
parent e5abc53701
commit 15876e85e5
2 changed files with 11 additions and 1 deletions
+6 -1
View File
@@ -372,7 +372,12 @@ PHP_FUNCTION(ldap_connect)
}
url = emalloc(urllen);
snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port );
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 );
}
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP
@@ -28,6 +28,10 @@ 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--
@@ -36,4 +40,5 @@ 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===