xref: /PHP-5.5/ext/snmp/tests/bug60749.phpt (revision 4c414c12)
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(dirname(__FILE__).'/skipif.inc');
8?>
9--FILE--
10<?php
11require_once(dirname(__FILE__).'/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--EXPECTF--
28bool(true)
29