xref: /PHP-7.1/ext/snmp/tests/bug64124.phpt (revision 7af945e2)
1--TEST--
2Bug #64124 IPv6 malformed
3--CREDITS--
4Boris Lytochkin
5--SKIPIF--
6<?php
7require_once(dirname(__FILE__).'/skipif.inc');
8
9$packed = str_repeat(chr(0), 15) . chr(1);
10if (@inet_ntop($packed) === false) {
11	die("skip no IPv6 support");
12}
13?>
14--FILE--
15<?php
16require_once(dirname(__FILE__).'/snmp_include.inc');
17
18# hostname variable was modified inline in netsnmp_session_init()
19# Should be checked with IPv6 since IPv4 processing code do not alter pointer position
20
21//EXPECTF format is quickprint OFF
22snmp_set_quick_print(false);
23snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
24
25$checkvar = "$hostname6_port";
26
27var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
28var_dump(($checkvar === $hostname6_port));
29var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
30var_dump(($checkvar === $hostname6_port));
31var_dump(snmpget($checkvar, $community, '.1.3.6.1.2.1.1.1.0'));
32var_dump(($checkvar === $hostname6_port));
33?>
34--EXPECTF--
35%unicode|string%(%d) "%s"
36bool(true)
37%unicode|string%(%d) "%s"
38bool(true)
39%unicode|string%(%d) "%s"
40bool(true)
41