if I cast a database field in a model to float like so
protected $casts = [
'balance' => 'float',
];
it returns INF string instead of a number. (this is how I access it)
\Log::debug("balance - ".$this->balance);
PS
It was working ok in Laravel 5.6.33
What is the definition of that column?
What is the actual value in the database, before a cast is tried?
Definition: balance | decimal(10,2)
Actual value is different every time, it is generated by unit test
I'm back on Laravel 5.6.33 and everything is working fine here.
Does the unit test generate Infinity values? That's the value that gets converted to INF since #24936.
@staudenmeir It would be great if you'd send a PR to the docs to document this in the upgrade guide as a breaking change.
@X-Coder264 Done.
I'm using MySQL, not PostgreSQL.
I have never had a need to use infinity values. This is how I set a condition for a unit test
$amount = round((rand(99, 99999) / 100, 2);
$amount1 = round($amount / 3, 2);
$amount2 = round($amount * 3, 2);
$accountCash->balance = 0;
$accountCash->save();
yes, the problem is found , thank you @staudenmeir.
this is the commit #24936
if the value is 0 it will return the first case from the switch
example
https://eval.in/1048636
The wonders of PHP... I'll fix it. Thanks for testing 5.7.
Most helpful comment
The wonders of PHP... I'll fix it. Thanks for testing 5.7.