Skip to content

Commit 2736929

Browse files
committed
Merge pull request #640 from magento-sparta/2.0.7_backlog
[Support] Magento 2.0.7 Backlog
2 parents 17ac035 + 41f4ace commit 2736929

File tree

1 file changed

+17
-1
lines changed
  • lib/internal/Magento/Framework/App/Config

1 file changed

+17
-1
lines changed

lib/internal/Magento/Framework/App/Config/Data.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ class Data implements DataInterface
2929
*/
3030
public function __construct(MetadataProcessor $processor, array $data)
3131
{
32-
$this->_data = $processor->process($data);
32+
/** Clone the array to work around a kink in php7 that modifies the argument by reference */
33+
$this->_data = $processor->process($this->_arrayClone($data));
3334
$this->_source = $data;
3435
}
3536

@@ -77,4 +78,19 @@ public function setValue($path, $value)
7778
}
7879
$currentElement[$lastKey] = $value;
7980
}
81+
82+
/**
83+
* Copy array by value
84+
*
85+
* @param array $data
86+
* @return array
87+
*/
88+
private function _arrayClone(array $data)
89+
{
90+
$clone = [];
91+
foreach ($data as $key => $value) {
92+
$clone[$key]= $value;
93+
}
94+
return $clone;
95+
}
8096
}

0 commit comments

Comments
 (0)