Skip to content

Pre-existing defects found during the 4.9 review #351

Description

@somethingwithproof

Found while reviewing the 4.9 changes. All predate the current cycle.

1. lib/mactrack_3com.php:84 — this UPDATE can never run

db_execute('UPDATE mac_track_interface_graphs
	SET ifIndex = ?, ifName = ?
	WHERE device_id = ?
	AND local_graph_id = ?',
	[$key, $ifdesc, $device['device_id'], $$local_graph_id[$i]['local_graph_id']]);

Two faults on one statement. db_execute($sql, $log = true, $db_conn = false) takes no parameter array, so the array lands in $log and the four ? placeholders are never bound. And $local_graph_id is an array (line 81 calls cacti_sizeof() on it), so $$local_graph_id is a variable variable over an array, giving Array to string conversion and Undefined variable $Array on PHP 8.

Traces to 88d8a7d (2020). Should be db_execute_prepared() with $local_graph_id[$i]['local_graph_id'].

2. lib/mactrack_functions.php:2090trim(null) deprecation on PHP 8.1

function xform_net_address($ip_address) {
	$ip_address = trim($ip_address);

The sibling xform_mac_address() one function down was hardened to trim((string) $mac_address); this one was not. Four call sites pass an unguarded array lookup: lib/mactrack_functions.php:2885, lib/mactrack_extreme.php:238, lib/mactrack_extreme.php:269, lib/mactrack_h3c_3com.php:433. An absent SNMP index emits a deprecation on every scan cycle. Same class as #223.

3. poller_mactrack.php:317-325errors_disable() and errors_restore() are no-ops

Both rely on track_errors, removed in PHP 8.0, so they do nothing on any supported version.

4. poller_mactrack.php:372case E_STRICT:

E_STRICT is deprecated in PHP 8.4 and emits a notice on that CI leg.

5. setup.php:26 — hook that never fires

api_plugin_register_hook('mactrack', 'top_header_tabs', ...). The hook name is valid but no Cacti release calls api_plugin_hook('top_header_tabs'); core only fires top_graph_header_tabs, which line 27 already registers for the same callback. Harmless, but dead.

6. mactrack_view_graphs.php:42 — globals that do not exist

global ... $host_template_hashes, $graph_template_hashes; are defined nowhere in Cacti core on any branch and assigned nowhere in the plugin.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions