Deprecated implicit float-to-int conversion
Description of the Bug
Hi,
I’ve encountered an issue with the from() method in the Subscription class
public static function from(array $resourceAttributes): self
Specifically, when setting the currency exchange rate (exchange_rate) for a subscription, the method appears to rely on an implicit conversion from float to int. This behavior has been deprecated in newer versions of PHP, starting from 8.1+, and will potentially trigger deprecation warnings or even fatal errors in future releases.
This deprecation is part of an official PHP RFC: 👉 https://wiki.php.net/rfc/implicit-float-int-deprecate
Why this matters:
Implicit float-to-int conversion can lead to silent data loss or unexpected results, particularly in financial calculations.
It creates compatibility issues with future versions of PHP.
It increases the risk of runtime errors in production systems using this SDK.
Steps to reproduce
I've attached the stack trace of the deprecation warning below for reference.
Expected Behavior
Suggested solution:
accept and handle float values properly where applicable
Code Snippets (if applicable)
Operating System
linux
Language version
PHP 8.1
Library version
v4.3
Additional context
No response
Hi @pawel-gagatek, thanks for reporting this. We've fixed it in v4.4.0—please give it a try and let us know if you still run into any issues.
Hi @pawel-gagatek, thanks for reporting this. We've fixed it in
v4.4.0—please give it a try and let us know if you still run into any issues.
works good to me :) i am closing this issue then