Skip to content

Commit

Permalink
fix: TypeError in number_to_amount()
Browse files Browse the repository at this point in the history
TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given
  • Loading branch information
kenjis committed Jun 2, 2024
1 parent 10a0739 commit 3d6436e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion system/Helpers/number_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null)
// Strip any formatting & ensure numeric input
try {
// @phpstan-ignore-next-line
$num = 0 + str_replace(',', '', $num);
$num = 0 + str_replace(',', '', (string) $num);
} catch (ErrorException) {
// Catch "Warning: A non-numeric value encountered"
return false;
}

Expand Down

0 comments on commit 3d6436e

Please sign in to comment.