Skip to content

Commit e1c477a

Browse files
committed
Merge branch '2.8' into 3.0
* 2.8: (23 commits) [Filesystem] Better error handling in remove() [DependencyInjection] Add coverage for invalid Expression in exportParameters [DependencyInjection] Add coverage for all invalid arguments in exportParameters anonymous services are always private [Console] Correct time formatting. [WebProfilerBundle] Fixed error from unset twig variable Force profiler toolbar svg display [DependencyInjection] Resolve aliases before removing abstract services + add tests Fix Dom Crawler select option with empty value Remove unnecessary option assignment fix tests (use non-deprecated options) remove unused variable mock the proper method [PropertyAccess] Fix regression [HttpFoundation] Improve phpdoc [Logging] Add support for firefox in ChromePhpHandler Windows 10 version check in just one line Detect CLI color support for Windows 10 build 10586 [Security] Fixed SwitchUserListener when exiting an impersonication with AnonymousToken [EventDispatcher] Try first if the event is Stopped ...
2 parents 475e661 + 3992ef9 commit e1c477a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

PropertyAccessor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
191191
if ($propertyPath->isIndex($i)) {
192192
if ($overwrite = !isset($zval[self::REF])) {
193193
$ref = &$zval[self::REF];
194+
$ref = $zval[self::VALUE];
194195
}
195196
$this->writeIndex($zval, $property, $value);
196197
if ($overwrite) {

Tests/PropertyAccessorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,4 +529,14 @@ public function testSetTypeHint()
529529
$this->propertyAccessor->setValue($object, 'date', $date);
530530
$this->assertSame($date, $object->getDate());
531531
}
532+
533+
public function testArrayNotBeeingOverwritten()
534+
{
535+
$value = array('value1' => 'foo', 'value2' => 'bar');
536+
$object = new TestClass($value);
537+
538+
$this->propertyAccessor->setValue($object, 'publicAccessor[value2]', 'baz');
539+
$this->assertSame('baz', $this->propertyAccessor->getValue($object, 'publicAccessor[value2]'));
540+
$this->assertSame(array('value1' => 'foo', 'value2' => 'baz'), $object->getPublicAccessor());
541+
}
532542
}

0 commit comments

Comments
 (0)