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

When attempting to display actions that can be taken, having no actions caused error #2456

Closed
netniV opened this issue Feb 26, 2019 · 1 comment
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@netniV
Copy link
Member

netniV commented Feb 26, 2019

Describe the bug
If an array is used to build up the actions to be performed, and the array is empty or the variable is null, draw_actions_dropdown() will fail and cause a backtrace.

To Reproduce
Steps to reproduce the behavior:

  1. include 'lib/html.php'
  2. call draw_actions_dropdown(NULL)
  3. See error

Expected behavior
If there are no actions to be performed, or the variable isn't primed, draw_actions_dropdown() should simply exit without error.

Additional context

2019/02/26 12:24:28 - CMDPHP PHP ERROR Backtrace: (CactiShutdownHandler())
2019/02/26 12:24:28 - ERROR PHP ERROR: Uncaught Error: Unsupported operand types in /usr/share/cacti/develop/lib/html.php:1377 
Stack trace:
 #0 /usr/share/cacti/develop/plugins/webseer/webseer.php(430): draw_actions_dropdown(NULL)
 #1 /usr/share/cacti/develop/plugins/webseer/webseer.php(46): list_urls()
 #2 {main} thrown in file: /usr/share/cacti/develop/lib/html.php on line: 1377

This was caused by a variable being used globally, that wasn't properly registering as a global variable. As such, when the edit form was being displayed, the above stack trace appeared because the global variable was thought to be empty.

@netniV netniV changed the title function 'draw_actions_dropdown()' does not correctly handle $actions_array being empty When attempting to display actions that can be taken, having no actions caused error Feb 26, 2019
netniV added a commit that referenced this issue Feb 26, 2019
When attempting to display actions that can be taken, having no actions caused error
@netniV netniV added the bug Undesired behaviour label Feb 26, 2019
@netniV netniV added this to the v1.2.3 milestone Feb 26, 2019
@netniV
Copy link
Member Author

netniV commented Feb 26, 2019

This has now been committed to the development code.

@netniV netniV closed this as completed Feb 26, 2019
@cigamit cigamit added the resolved A fixed issue label Jun 24, 2019
@github-actions github-actions bot locked as resolved 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

2 participants