Skip to content

Bug: liveview uses $map[0]['configfile'] on flat row from db_fetch_row_prepared() #207

@somethingwithproof

Description

@somethingwithproof

Summary

In weathermap-cacti-plugin.php, the liveview case fetches a single row:

$map = db_fetch_row_prepared("SELECT wm.* FROM weathermap_maps ...", [$id]);
if (cacti_sizeof($map)) {
    $maptitle = $map['titlecache'];    // correct flat access
    // ...
    $mapname = $map[0]['configfile'];  // BUG: $map is flat, not array-of-rows
}

db_fetch_row_prepared() returns a flat associative array. $map[0] is null. $mapname is null. $mapfile becomes $confdir . '/' (the directory itself). The WeatherMap engine then tries to ReadConfig() on a directory path. Liveview silently renders nothing.

This is an old-style $map[0][...] pattern from before the Cacti migration that was not updated.

Fix

Change $map[0]['configfile'] to $map['configfile'].

Priority

Hard failure. Queue for Friday.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions