-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix casting issues (issue: #2703) #2705
Conversation
This will not change how it functions, just makes it simpler
I will update the changelog and see if there's any documentation to update later today |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @stubbo, thanks for investigating the issue and submitting a patch.
@hans-thomas you may be interested in reviewing this PR as you worked on this part previously.
try { | ||
$value = (string) BigDecimal::of((string) $value)->toScale((int) $decimals, RoundingMode::HALF_UP); | ||
|
||
return new Decimal128($value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Good catch, the method asDecimal
must return a string, as mandated in the phpdoc of the parent method.
Co-authored-by: Jérôme Tamarelle <[email protected]>
Co-authored-by: Jérôme Tamarelle <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this changes with my project and it seems solved the problem
@GromNaN Do you want me to update the change log? |
Hi @GromNaN, I will be unavailable for next month too. sorry. |
Summary
#2653 Added a cast inside of the setAttribute, intended to be used when accessing raw data from a model, not adding data.
This will cause some casts to break fully. If you have the encrypt cast it will try to decrypt a string before encrypting it which causes an exception.
I have explained this in more detail in issue #2703
Checklist