DBAL-83: BigInt Type is returning string instead of integer #2064

doctrinebot opened this Issue Jan 28, 2011 · 4 comments

2 participants


Jira issue originally created by user adrive:

I ran all tests with PostgreSQL and I got an error:

1) Doctrine\Tests\DBAL\Functional\TypeConversionTest::testIdempotentDataConversion with data set #3 ('bigint', 12345678, 'string')
The expected type from the conversion to and back from the database should be string
Failed asserting that <integer:12345678> is of type "string".


Tests: 367, Assertions: 745, Failures: 1, Skipped: 8.

The BigInt Type is missing convertToPHPValue() method and returns string instead of int. I fixed this and also I fixed the test case for this. Patch will be availabe via github pull request.


Comment created by @beberlei:

Bigints have to be strings for int overflow reasons. PostgreSQL seems to detect 64 vs 32bit systems and casts correctly, this is unfortunate for the tests, i have to come up with a workdaround for this :-)


Issue was closed with resolution "Won't Fix"


Comment created by heruan:

This behavior can't be correct:

php > var_dump($object->id);
php > $em->persist($object);
php > vardump($em->find(getclass($object), 201308090001)->id);

The type should be consistent no matter what, otherwise the idempotent requirement breaks.


Comment created by @beberlei:

[~heruan] This was fixed, bigint identity generation will always work with strings.

@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@beberlei beberlei was assigned by doctrinebot Dec 7, 2015
@doctrinebot doctrinebot closed this Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment