centreon / centreon-open-tickets

Module dedicated to open case on various Ticket systems from Centreon UI
Apache License 2.0
10 stars 25 forks source link

Check group variable type to avoid fatal error with iTop provider #242

Closed Sims24 closed 2 years ago

Sims24 commented 2 years ago

Description

Closes https://github.com/centreon/centreon-open-tickets/pull/237/files

Fix fatal error in centreon-error.log when trying to open a ticket with iTop provider.

Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in /usr/share/centreon/GPL_LIB/SmartyCache/compile/fdf91122f2894e9f67b971588eee542ebcb59e37_0.file.group.ihtml.php:41

The reason is that the iTop provider have dynamic lists that are displayed. The $group variable for those lists will only be set when other lists have a selected value.

The issue happens since https://github.com/centreon/centreon-open-tickets/commit/5f17e24afa4690ef43132dc90b947b58ebb0a795 so it is better to handle it right from the smarty file

Type of change

Target serie

How this pull request can be tested ?

Checklist

Community contributors & Centreon team

sonarqube-decoration[bot] commented 2 years ago

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information