Skip to content

When viewing logs, unexpected 'needle' errors can be seen on rare occasions #3659

@netniV

Description

@netniV

Describe the bug

07/06/2020 01:46:35 - ERROR PHP WARNING: strpos(): Empty needle in file: /usr/share/cacti/site/lib/clog_webapi.php  on line: 76
07/06/2020 01:46:35 - CMDPHP PHP ERROR WARNING Backtrace:  (/clog.php[40]:clog_view_logfile(), /lib/clog_webapi.php[247]:filter(), /lib/clog_webapi.php[483]:clog_get_logfiles(), /lib/clog_webapi.php[416]:clog_validate_filename(), /lib/clog_webapi.php[76]:strpos(), CactiErrorHandler())

The above is seen because basename($logfile) is performed before an empty logfile is initialized to a default value.

Expected behavior

No error and logbase set after filename fully initialized

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behaviourunverifiedSome days we don't have a clue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions