What happened?
Description
I have a Number field with Decimal Points set to 0. When executing an entry query with all(), one(), etc., the value is returned as an integer with no decimal points, as expected. But when using methods such as scalar(), pairs(), column(), the value is returned as a string with 16 decimal points.
// Given a field named `myNumberField` with a value of "99"...
// This returns 99 as an integer
Entry::find()
->id($entryId)
->one()
->myNumberField;
// But this returns "99.0000000000000000"
Entry::find()
->id($entryId)
->select('myNumberField')
->scalar();
This is for a project where I am upgrading from Craft v4. None of these queries have been modified, and they were previously returning the expected values.
Steps to reproduce
- Create a Number field and set Decimal Points to
0.
- Add field to an entry type and create an entry with an integer as the field value.
- Query for that entry, select the Number field, and execute the query using
scalar().
Expected behavior
Value should be returned without decimal points.
Actual behavior
Value is returned with decimal points.
Craft CMS version
5.5.7
PHP version
8.3
Operating system and version
No response
Database type and version
MySQL 8.0.36
Image driver and version
No response
Installed plugins and versions
No response
What happened?
Description
I have a Number field with Decimal Points set to
0. When executing an entry query withall(),one(), etc., the value is returned as an integer with no decimal points, as expected. But when using methods such asscalar(),pairs(),column(), the value is returned as a string with 16 decimal points.This is for a project where I am upgrading from Craft v4. None of these queries have been modified, and they were previously returning the expected values.
Steps to reproduce
0.scalar().Expected behavior
Value should be returned without decimal points.
Actual behavior
Value is returned with decimal points.
Craft CMS version
5.5.7
PHP version
8.3
Operating system and version
No response
Database type and version
MySQL 8.0.36
Image driver and version
No response
Installed plugins and versions
No response