Closed vibby closed 4 years ago
@vibby v3.1 has been released. Can you rebase your PR ?
Done
Can you please consider merging it @PedroTroller ?
@vibby I think there is a problem. If you have a dictionary like
"foo" => "bar",
12 => null,
When you try to access the key 0
, you will have the error
The key 0 (integer) doesn't exist in the given dictionary. foo, 12 (string) available
But the key 12
is not a string.
Maybe I am wrong @PedroTroller, but I think the method getKeys
of interface Knp\DictionaryBundle\Dictionary
always returns an array with integer keys (0, 1, 2…), not an associative array. Anyway, I can ensure it with a reset
function
True but you don't check the keys of the return of getKeys
but the values.
I changed it to use the reset function. Is that ok this way ?
@vibby no, the problem remains the same. Not all keys have the same type.
How about this : https://github.com/KnpLabs/DictionaryBundle/pull/125/files ?
I got it. A proposal soon :)
Got it, it now search for the «same» key but in a different type
Avoid useless error message : «The key 0 doesn't exist in the given dictionary. 0,1,2 available» Replace it with this : «The key 0 (string) doesn't exist in the given dictionary. 0,1,2 (integer) available»