Skip to content


DDC-2784: Invalid cache entries on 32bit arch when PHP_MAX_INT is hit #3532

doctrinebot opened this Issue · 4 comments

2 participants


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.

string(10) "2186935411"
string(31) "Doctrine\DBAL\Types\IntegerType"
Raw Data:
    [id0] => 2186935411

Hydrated Data:
array(1) {
  'r' =>
  array(6) {
    'id' =>

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.


Comment created by @ocramius:

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"

@Ocramius Ocramius was assigned by doctrinebot
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.