php-src/ext/ldap/tests/ldap_connect_port_error.phpt
David Carlier 5d4846b241
ext/ldap: simplify ldap_connect() workflow, fix url leak.
delaying the object creation only before ldap initialisation.
fix forgotten url freeing on TLS error code path.

close GH-18645
2025-05-25 12:53:28 +01:00

24 lines
499 B
PHP

--TEST--
ldap_connect() - Connection errors
--EXTENSIONS--
ldap
--INI--
error_reporting=E_ALL & ~E_DEPRECATED
--FILE--
<?php
require "connect.inc";
try {
ldap_connect("nope://$host", 65536);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
ldap_connect("nope://$host", 0);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
ldap_connect(): Argument #2 ($port) must be between 1 and 65535
ldap_connect(): Argument #2 ($port) must be between 1 and 65535