Jira issue originally created by user rhodie:
On machines which max int size is 2147483647, when entry from the database is hydrated and it's id goes thru convertToPHPValue of IntegerType, integer overflow occurs which leads to wrong entry returned from the gatherRowData() method in the AbstractHydrator
When the result from the repository is requested as Object, the whole object is returned from the cache which leads to wrong data returned from the repository.
[id0] => 2186935411
When the result is hydrated as scalar or array, only the id of the entry remains same, the data is fetched correctly from the table.
Workaround would be to stop looking into the cache when the id of the result hits the PHPMAXINT of the system.
Comment created by @ocramius:
[~rhodie] shouldn't you map the field as a decimal or as a string when you hit those barriers?
Comment created by rhodie:
Yes this really helps. But the default behaviour is a little bit tricky and can lead to nasty bugs in production. You can consider this as "known issue" then.
Marking as can't fix: if we hit limitations of the engine about usage of integers, we need to use strings for storing larger numbers.
Issue was closed with resolution "Can't Fix"