Skip to content

Changing the hydration mode doesn't give the same type of result for BigInt #11527

@VincentLanglet

Description

@VincentLanglet

Bug Report

Q A
BC Break no
Version 2.19

Summary

Hi.

I'm note sure if it's a bug or a wanted behavior (and for what reason) but the type of a bigint value is return by a query is different when changing the Hydration mode. Let's take

Current behavior

With HYDRATE_OBJECT or HYDRATE_ARRAY I'm getting ["42"],
but with HYDRATE_SCALAR or HYDRATE_SINGLE_SCALAR, I'm getting [42]and withHYDRATE_SCALAR_COLUMNI'm getting42`.

How to reproduce

$this->createQueryBuilder('d')
            ->select('d.id') // where the id is a bigInt field
            ->setMaxResults(1)
            ->getQuery()
            ->getSingleResult();

Expected behavior

I would expect to get "42" everytime (in DBAL 3).

This is kinda fixed by DBAL 4 where int will be the type of value in HYDRATE_OBJECT or HYDRATE_ARRAY if think for bigInt.
But I wonder, if this happen for bigint in DBAL 3, this might happen for some other value/type. This would require investigation but I prefer first to know if it's considered as a bug or done by design.

Is there a valid reason for not having basically

HYDRATE_SCALAR_COLUMN = array_column(HYDRATE_ARRAY, 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions