Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Broken validation ChoiceType with query_builder #15642

Closed
@DmitriiBezborodnikov

Description

@DmitriiBezborodnikov
// Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader.php
    public function getEntitiesByIds($identifier, array $values)
    {
         //...
         if (in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) {
            $parameterType = Connection::PARAM_INT_ARRAY;

            // Filter out non-integer values (e.g. ""). If we don't, some
            // databases such as PostgreSQL fail.
            $values = array_values(array_filter($values, function ($v) {
                return (string) $v === (string) (int) $v;
            }));
         } 
         //...
    }
}

On Windows (apache + php 32bit) bigint great 2147483647 always after (int) set to 2147483647: ((int) 2147483648) === 2147483647 // true

$values = array_values(array_filter($values, function ($v) {
                return (string) $v === (string) (int) $v;
            }));

Its clears $values great then 2147483647 and breaks the validation ChoiceType

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions