forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathipv6.phpt
More file actions
33 lines (30 loc) · 753 Bytes
/
ipv6.phpt
File metadata and controls
33 lines (30 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
IPv6 support
--CREDITS--
Boris Lytochkin
--EXTENSIONS--
snmp
--SKIPIF--
<?php
require_once(__DIR__.'/skipif.inc');
$packed = str_repeat(chr(0), 15) . chr(1);
if (@inet_ntop($packed) === false) {
die("skip no IPv6 support");
}
?>
--FILE--
<?php
require_once(__DIR__.'/snmp_include.inc');
//EXPECTF format is quickprint OFF
snmp_set_quick_print(false);
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
var_dump(snmpget($hostname6_port, $community, '.1.3.6.1.2.1.1.1.0'));
try {
var_dump(snmpget('[dead:beef::', $community, '.1.3.6.1.2.1.1.1.0'));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECTF--
string(%d) "%s"
snmpget(): Argument #1 ($hostname) has a malformed IPv6 address, closing square bracket missing