diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-11-16 17:00:16 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-11-16 17:00:16 +0800 |
commit | 25439e939e8d6a86bcc1654221460851b43271d5 (patch) | |
tree | bc14180d90d4cad613c1dd72b25fcac9ad41c9d7 | |
parent | be6fd4ba89e151b68ddd68e53d6a403c2e8eb862 (diff) | |
parent | 15876e85e59658bfbda3bf0b0c34d56ca503fd2f (diff) | |
download | php-git-25439e939e8d6a86bcc1654221460851b43271d5.tar.gz |
Merge branch 'PHP-5.6' of git.php.net:/php-src into PHP-5.6
-rw-r--r-- | ext/ldap/ldap.c | 7 | ||||
-rw-r--r-- | ext/ldap/tests/ldap_connect_variation.phpt | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index da8936cd76..8b66ba44ca 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -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 diff --git a/ext/ldap/tests/ldap_connect_variation.phpt b/ext/ldap/tests/ldap_connect_variation.phpt index 09b07e7786..eaee261542 100644 --- a/ext/ldap/tests/ldap_connect_variation.phpt +++ b/ext/ldap/tests/ldap_connect_variation.phpt @@ -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=== |