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