Skip to content

Commit 3d6436e

Browse files
committed
fix: TypeError in number_to_amount()
TypeError: str_replace(): Argument #3 ($subject) must be of type array|string, int given
1 parent 10a0739 commit 3d6436e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

system/Helpers/number_helper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ function number_to_amount($num, int $precision = 0, ?string $locale = null)
8282
// Strip any formatting & ensure numeric input
8383
try {
8484
// @phpstan-ignore-next-line
85-
$num = 0 + str_replace(',', '', $num);
85+
$num = 0 + str_replace(',', '', (string) $num);
8686
} catch (ErrorException) {
87+
// Catch "Warning: A non-numeric value encountered"
8788
return false;
8889
}
8990

0 commit comments

Comments
 (0)