Bug Value formatter can return int type when requested a float

There is a bug in this version
K

Kruzya

Guest
PHP:

Code:
$input = 999.00;
$type = \XF\Mvc\Entity\Entity::FLOAT;

$output = \XF::em()->getValueFormatter()->castValueToType($input, $type, []);

var_dump($input); // float(999)
var_dump($output); // int(999)

This is not big problem, if we're not working with entities:
PHP:

Code:
$item = \XF::em()->create('Something:Item'); // cost_amount - FLOAT, cost_currency - STR
$item->cost_amount = 999.00;
$item->cost_currency = 'RUR';
$item->save();

if ($item->isChanged('cost_amount') ||...

Read more

Continue reading...