Issues (2963)

html/pages/device/ports/neighbours.inc.php (3 issues)

1
<?php
2
3
echo '<table class="table table-hover table-condensed">
4
    <thead>
5
        <tr>
6
            <th>Local Port</th>
7
            <th>Remote Device</th>
8
            <th>Remote Port</th>
9
            <th>Protocol</th>
10
        </tr>
11
    </thead>';
12
13
foreach (dbFetchRows('SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.port_id = L.local_port_id order by ifName', [$device['device_id']]) as $neighbour) {
14
    $neighbour = cleanPort($neighbour);
15
    echo '<td>' . generate_port_link($neighbour) . '<br>' . $neighbour['ifAlias'] . '</td>';
0 ignored issues
show
Are you sure generate_port_link($neighbour) of type array|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

15
    echo '<td>' . /** @scrutinizer ignore-type */ generate_port_link($neighbour) . '<br>' . $neighbour['ifAlias'] . '</td>';
Loading history...
16
    if (is_numeric($neighbour['remote_port_id']) && $neighbour['remote_port_id']) {
17
        $remote_port = cleanPort(get_port_by_id($neighbour['remote_port_id']));
0 ignored issues
show
It seems like get_port_by_id($neighbour['remote_port_id']) can also be of type false; however, parameter $interface of cleanPort() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

17
        $remote_port = cleanPort(/** @scrutinizer ignore-type */ get_port_by_id($neighbour['remote_port_id']));
Loading history...
18
        $remote_device = device_by_id_cache($remote_port['device_id']);
19
        echo '<td>' . generate_device_link($remote_device) . '<br>' . $remote_device['hardware'] . '</td>
20
              <td>' . generate_port_link($remote_port) . '<br>' . $remote_port['ifAlias'] . '</td>';
0 ignored issues
show
Are you sure generate_port_link($remote_port) of type array|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

20
              <td>' . /** @scrutinizer ignore-type */ generate_port_link($remote_port) . '<br>' . $remote_port['ifAlias'] . '</td>';
Loading history...
21
    } else {
22
        echo '<td>' . $neighbour['remote_hostname'] . '<br>' . $neighbour['remote_platform'] . '</td>
23
              <td>' . $neighbour['remote_port'] . '</td>';
24
    }
25
    echo '<td>' . strtoupper($neighbour['protocol']) . '</td></tr>';
26
}
27
echo '</table>';
28