1--TEST--
2net_get_interfaces IPv4 Loopback
3--SKIPIF--
4<?php
5function_exists('net_get_interfaces') || print 'skip';
6?>
7--FILE--
8<?php
9
10// Test that we have exactly one unicast address with the address 127.0.0.1
11// On linux this will often be named "lo", but even that isn't guaranteed.
12
13$ifaces = net_get_interfaces();
14
15$found = false;
16foreach ($ifaces as $iface) {
17  foreach ($iface['unicast'] as $unicast) {
18    if (($unicast['address'] ?? null) === '127.0.0.1') {
19      $found = true;
20      break 2;
21    }
22  }
23}
24
25var_dump($found);
26if (!$found) {
27  // Extra diagnostics!
28  var_dump($ifaces);
29}
30?>
31--EXPECT--
32bool(true)
33