Skip to content

Commit f732659

Browse files
kalessilfabpot
authored andcommitted
[2.3] SCA for Components - reference mismatches
1 parent 0b1f172 commit f732659

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function __construct($storageKey = '_sf2_attributes', $namespaceCharacter
4343
*/
4444
public function has($name)
4545
{
46+
// reference mismatch: if fixed, re-introduced in array_key_exists; keep as it is
4647
$attributes = $this->resolveAttributePath($name);
4748
$name = $this->resolveKey($name);
4849

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

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,10 @@ private function writeProperty(&$object, $property, $singular, $value)
304304
// see https://github.com/symfony/symfony/issues/4670
305305
$itemsToAdd = is_object($value) ? iterator_to_array($value) : $value;
306306
$itemToRemove = array();
307-
$propertyValue = $this->readProperty($object, $property);
307+
$propertyValue = &$this->readProperty($object, $property);
308308
$previousValue = $propertyValue[self::VALUE];
309+
// remove reference to avoid modifications
310+
unset($propertyValue);
309311

310312
if (is_array($previousValue) || $previousValue instanceof \Traversable) {
311313
foreach ($previousValue as $previousItem) {

0 commit comments

Comments
 (0)