Skip to content

[PropertyAccess] setValue (again) replace array when not needed #18437

@MisatoTremor

Description

@MisatoTremor

This behavior has been mentioned in #13731 by @Tobion and fixed in #13835 by @bananer but was reintroduced later (my guess would be #18224 as it introduced the code that replaces the array).

In the following test case the second assertion fails because after the setValue call the publicAccessor property of object has the value array('value2' => 'baz') instead of array('value1' => 'foo', 'value2' => 'baz').

    public function testArrayNotBeeingOverwritten()
    {
        $value = array('value1' => 'foo', 'value2' => 'bar');
        $object = new TestClass($value);

        $this->propertyAccessor->setValue($object, 'publicAccessor[value2]', 'baz');
        $this->assertSame('baz', $this->propertyAccessor->getValue($object, 'publicAccessor[value2]'));
        $this->assertSame(array('value1' => 'foo', 'value2' => 'baz'), $object->getPublicAccessor());
    }

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