Skip to content

fix checking for correct formatter in durationDecimal#5943

Merged
kevinpapst merged 1 commit into
kimai:mainfrom
helsinki-systems:fix/locale-formatter-duration-decimal-guard
May 12, 2026
Merged

fix checking for correct formatter in durationDecimal#5943
kevinpapst merged 1 commit into
kimai:mainfrom
helsinki-systems:fix/locale-formatter-duration-decimal-guard

Conversation

@cheriimoya

Copy link
Copy Markdown
Contributor

Description

LocaleFormatter::durationDecimal() guarded the lazy initialization of $this->decimalFormatter with the wrong property ($this->numberFormatter instead of $this->decimalFormatter). If amount() was called before durationDecimal() on the same formatter instance, $this->numberFormatter would already be set, the guard would pass, $this->decimalFormatter would never be initialized, and the subsequent ->format() call would fail on null.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I verified that my code applies to the guidelines (composer code-check)
  • I updated the documentation (see here)
  • I agree that this code is used in Kimai (see license)

@cheriimoya cheriimoya force-pushed the fix/locale-formatter-duration-decimal-guard branch from e53a8a2 to de94f11 Compare May 11, 2026 16:59
@kevinpapst kevinpapst changed the base branch from main to release-2.57 May 12, 2026 07:31
@kevinpapst kevinpapst changed the base branch from release-2.57 to main May 12, 2026 07:31

@kevinpapst kevinpapst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks @cheriimoya 👍

@kevinpapst kevinpapst added the bug label May 12, 2026
@codecov

codecov Bot commented May 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.90%. Comparing base (ebb54e9) to head (de94f11).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #5943   +/-   ##
=========================================
  Coverage     87.90%   87.90%           
  Complexity     9840     9840           
=========================================
  Files           876      876           
  Lines         31484    31484           
=========================================
  Hits          27675    27675           
  Misses         3809     3809           
Files with missing lines Coverage Δ
src/Utils/LocaleFormatter.php 86.95% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kevinpapst kevinpapst merged commit f0ce1c7 into kimai:main May 12, 2026
7 checks passed
@cheriimoya cheriimoya deleted the fix/locale-formatter-duration-decimal-guard branch May 12, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants