Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation cache can sometimes be corrupted resulting in a non-array value #2912

Closed
bmfmancini opened this issue Aug 23, 2019 · 5 comments
Closed
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@bmfmancini
Copy link
Member

Hello Everyone

I am seeing multiple PHP errors coming in on 1.2.5 I also am seeing alot of errors coming out of the thold plugin which I have reported to that tracker not sure if the below is part of that

however the path shows that its the cacti core file with errors

2019/08/23 12:12:53 - CMDPHP PHP ERROR NOTICE Backtrace: (/pollers.php[249]:top_header(), /lib/functions.php[3229]:include_once(), /include/top_header.php[43]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:53 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:53 - CMDPHP PHP ERROR NOTICE Backtrace: (/pollers.php[249]:top_header(), /lib/functions.php[3229]:include_once(), /include/top_header.php[27]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:53 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:47 - CMDPHP PHP ERROR NOTICE Backtrace: (/index.php[26]:top_header(), /lib/functions.php[3229]:include_once(), /include/top_header.php[49]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:47 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:47 - CMDPHP PHP ERROR NOTICE Backtrace: (/index.php[26]:top_header(), /lib/functions.php[3229]:include_once(), /include/top_header.php[27]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:47 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:43 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph_view.php[355]:grow_right_pane_tree(), /lib/html_tree.php[1207]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:43 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:43 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph_view.php[280]:top_graph_header(), /lib/functions.php[3237]:include_once(), /include/top_graph_header.php[43]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:43 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:43 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph_view.php[280]:top_graph_header(), /lib/functions.php[3237]:include_once(), /include/top_graph_header.php[28]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:43 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:42 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph_view.php[219]:top_graph_header(), /lib/functions.php[3237]:include_once(), /include/top_graph_header.php[49]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:42 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:42 - CMDPHP PHP ERROR NOTICE Backtrace: (/graph_view.php[219]:top_graph_header(), /lib/functions.php[3237]:include_once(), /include/top_graph_header.php[28]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:42 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:13 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/thold/thold_graph.php[53]:general_header(), /lib/functions.php[3244]:include_once(), /include/top_general_header.php[49]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:13 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595
2019/08/23 12:12:13 - CMDPHP PHP ERROR NOTICE Backtrace: (/plugins/thold/thold_graph.php[53]:general_header(), /lib/functions.php[3244]:include_once(), /include/top_general_header.php[27]:draw_navigation_text(), /lib/functions.php[2595]:CactiErrorHandler())
2019/08/23 12:12:13 - ERROR PHP NOTICE: Array to string conversion in file: /var/www/html/cacti/lib/functions.php on line: 2595

@bmfmancini
Copy link
Member Author

if (!$hasNavError) {
$nav_level_cache[$current_array['level']] = array(
'id' => $current_page . ':' . $current_action,
'url' => get_browser_query_string()
);

@netniV
Copy link
Member

netniV commented Aug 23, 2019

Someone else has reported this but I can't see how it occurs given these three checks right before the assignment that the above line refers to:

        if (is_array($current_page)) {
                cacti_log('WARNING: Navigation item suppressed - current page is not a string: ' . var_export($cur$
                $hasNavError = true;
        }

        if (is_array($current_action)) {
                cacti_log('WARNING: Navigation item suppressed - current action is not a string: '. var_export($cu$
                $hasNavError = true;
        }

        if (is_array($current_array['level'])) {
                cacti_log('WARNING: Navigation item suppressed - current level is not a string: ' . var_export($cu$
                $hasNavError = true;
        } 

Unless someone can spot a mistake with that code then this shouldn't generate a problem:

        if (!$hasNavError) {
                $nav_level_cache[$current_array['level']] = array(
                        'id' => $current_page . ':' . $current_action,
                        'url' => get_browser_query_string()
                );
        }
        $current_nav .= '</ul>';

@bmfmancini
Copy link
Member Author

@netniV
Copy link
Member

netniV commented Aug 23, 2019

Nope, because that's already being checked for by is_array()

@cigamit cigamit changed the title cacti 1.2.5 functions.php Errors Resolve navigation caching array to string conversion issues Aug 29, 2019
cigamit added a commit that referenced this issue Aug 29, 2019
Resolve navigation caching array to string conversion issues
@cigamit cigamit added bug Undesired behaviour resolved A fixed issue labels Aug 29, 2019
@cigamit cigamit added this to the v1.2.6 milestone Aug 29, 2019
@cigamit
Copy link
Member

cigamit commented Aug 29, 2019

I took a different approach on this after seeing some other bugs logged for thold and syslog. Take this update, and let us know if the issue is resolved.

@netniV netniV closed this as completed Aug 31, 2019
@netniV netniV changed the title Resolve navigation caching array to string conversion issues Navigation cache can sometimes be corrupted resulting in a non-array value Sep 1, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

3 participants