xref: /PHP-8.0/ext/snmp/tests/bug60749.phpt (revision f8d79582)
1--TEST--
2Bug #60749: SNMP module should not strip non-standard SNMP port from hostname
3--CREDITS--
4Boris Lytochkin
5--SKIPIF--
6<?php
7require_once(__DIR__.'/skipif.inc');
8?>
9--FILE--
10<?php
11require_once(__DIR__.'/snmp_include.inc');
12
13$hostname = "php.net";
14$ip = gethostbyname($hostname);
15if (ip2long($ip) === FALSE) {
16    echo "Could not resolve $hostname properly!\n";
17    exit(1);
18}
19$port = 1161;
20$session = new SNMP(SNMP::VERSION_1, "$hostname:$port", $community, $timeout, $retries);
21$info = $session->info;
22if (strcmp($info["hostname"], "$ip:$port") !== 0) {
23    echo "'" . $info["hostname"] . "' != '$ip:$port'\n";
24}
25var_dump($session->close());
26?>
27--EXPECT--
28bool(true)
29