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

Skip to content

OrderedHashMap compares keys loosely #24558

Closed
@maryo

Description

@maryo
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.10
$map = new OrderedHashMap();
$map['1 as a string'] = '1 as a string';
$map[1] = '1 as an integer';

unset($map[1]);

var_dump($map);

https://3v4l.org/ZWo3B

As you can see, after the unset of 1, it was correctly unset from the internal elements array. But incorrect key was removed from orderedKeys property. The key should be probably stored as a string and converted back when obtaining it so it behaves the same way as PHP array.
OrderedHashMapIterator needs to be adjusted as well.

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