Skip to content

Inconsistency between ArrayHelper functions #1

Closed
@Aradiv

Description

@Aradiv

What steps will reproduce the problem?

$arr=['a.b' => ['c' => 'value1', 'd.e' => "value2"]];
ArrayHelper.getValue($arr, 'a.b.c'); //this will return value1
ArrayHelper.setValue($arr, 'a.b.c', 'newValue');
ArrayHelper.getValue($arr, 'a.b.c'); //this will still return value1
ArrayHelper.keyExists('a.b.c', $arr,); //false
ArrayHelper.remove($arr, 'a.b.c'); //this wont work but is currently worked on in #168 

/*
$arr = [
  'a' => [
    'b' => [
      'c' => 'newValue',
    ],
  ],
  'a.b' => [
    'c' => 'value1',
   'd.e' => 'value2', // unreachable with dot syntax
  ]
]*/

What is the expected result?

Using the same key for any function in ArrayHelper (getValue, setValue, remove, keyExists) should result in accessing the same key.

What do you get instead?

Different behavior depending on which function you are using.

Additional info

Q A
Yii version 3.0@dev
PHP version 7.1
Operating system Debian 9

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