Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[2.3] SCA for Components - reference mismatches
  • Loading branch information
kalessil authored and fabpot committed Apr 15, 2015
1 parent 0b1f172 commit f732659
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -43,6 +43,7 @@ public function __construct($storageKey = '_sf2_attributes', $namespaceCharacter
*/
public function has($name)
{
// reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
$attributes = $this->resolveAttributePath($name);
$name = $this->resolveKey($name);

Expand All @@ -58,6 +59,7 @@ public function has($name)
*/
public function get($name, $default = null)
{
// reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
$attributes = $this->resolveAttributePath($name);
$name = $this->resolveKey($name);

Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/PropertyAccess/PropertyAccessor.php
Expand Up @@ -304,8 +304,10 @@ private function writeProperty(&$object, $property, $singular, $value)
// see https://github.com/symfony/symfony/issues/4670
$itemsToAdd = is_object($value) ? iterator_to_array($value) : $value;
$itemToRemove = array();
$propertyValue = $this->readProperty($object, $property);
$propertyValue = &$this->readProperty($object, $property);
$previousValue = $propertyValue[self::VALUE];
// remove reference to avoid modifications
unset($propertyValue);

if (is_array($previousValue) || $previousValue instanceof \Traversable) {
foreach ($previousValue as $previousItem) {
Expand Down

0 comments on commit f732659

Please sign in to comment.