centreon-archived icon indicating copy to clipboard operation
centreon-archived copied to clipboard

fix(clapi): Wrong test on undefined variable (#11438)

Open proxyconcept opened this issue 2 years ago • 3 comments

Refs: #11438 Signed-off-by: Grégory Marigot [email protected]

Description

Test for empty $paramString should use "isset" to avoid a PHP warning.

Fixes #11438

Type of change

  • [x] Patch fixing an issue (non-breaking change)
  • [ ] New functionality (non-breaking change)
  • [ ] Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • [ ] 21.04.x
  • [ ] 21.10.x
  • [x] 22.04.x
  • [ ] 22.10.x (master)

How this pull request can be tested ?

This patch suppress this kind of warning:

clapi -u admin -p '******' -o CMD -a getparam -v "host-notify-by-email;name"
PHP Warning:  Undefined variable $paramString in /usr/share/centreon/www/class/centreon-clapi/centreonCommand.class.php on line 218
name
host-notify-by-email

Checklist

Community contributors & Centreon team

  • [x] I have followed the coding style guidelines provided by Centreon
  • [x] I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • [x] I have commented my code, especially hard-to-understand areas of the PR.
  • [x] I have rebased my development branch on the base branch (master, maintenance).

proxyconcept avatar Jul 27 '22 17:07 proxyconcept

Related ticket : MON-15348

TamazC avatar Oct 06 '22 07:10 TamazC

SonarQube Quality Gate

Quality Gate passed

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

No Coverage information No Coverage information
100.0% 100.0% Duplication

SonarQube Quality Gate

Quality Gate passed

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

No Coverage information No Coverage information
100.0% 100.0% Duplication

migrated to https://github.com/centreon/centreon-gha/pull/

kduret avatar Nov 08 '22 14:11 kduret