Skip to content

fix: preserve zero values in cube dimension labels (#172) - #176

Open
DanielVdWP wants to merge 2 commits into
Icinga:mainfrom
DanielVdWP:fix/172-preserve-zero-dimension-labels
Open

DanielVdWP wants to merge 2 commits into
Icinga:mainfrom
DanielVdWP:fix/172-preserve-zero-dimension-labels

Conversation

@DanielVdWP

Copy link
Copy Markdown

Description

Fixes #172.

Cube dimension labels currently display an underscore (_) when a
custom variable contains the numeric value 0 or the string "0".

This happens because the dimension label renderer uses PHP's shorthand
ternary operator (?:), which treats zero values as falsy.

Changes

  • Preserve numeric and string zero values when rendering dimension labels.
  • Continue displaying _ for null, empty string, and false values.
  • Apply the fix to the shared dimension widget, covering both host
    and service cubes.

Testing

The following cases were verified locally using PHP 8.4:

  • Integer zero: displays 0.
  • String zero: displays 0.
  • Floating-point zero: displays 0.
  • Null: displays _.
  • Empty string: displays _.
  • Boolean false: displays _.
  • Non-zero integers and ordinary strings: remain unchanged.

The regression was reproduced against the original implementation.

PHP syntax validation passed.

GitHub Actions CI will run when the pull request is opened.

@cla-bot cla-bot Bot added the cla/signed label Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tile shows "_" (underscore) instead of value "0"

1 participant