Skip to content

Commit

Permalink
MAGETWO-48387: Payment/Shipping config decrypted twice on PHP7 when used
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale Sikkema committed Feb 1, 2016
1 parent c53d060 commit 32ca5c9
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/internal/Magento/Framework/App/Config/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class Data implements DataInterface
*/
public function __construct(MetadataProcessor $processor, array $data)
{
$this->_data = $processor->process($data);
/** Clone the array to work around a kink in php7 that modifies the argument by reference */
$this->_data = $processor->process($this->arrayClone($data));
$this->_source = $data;
}

Expand Down Expand Up @@ -77,4 +78,19 @@ public function setValue($path, $value)
}
$currentElement[$lastKey] = $value;
}

/**
* Copy array by value
*
* @param array $data
* @return array
*/
private function arrayClone(array $data)
{
$clone = [];
foreach ($data as $key => $value) {
$clone[$key]= $value;
}
return $clone;
}
}

12 comments on commit 32ca5c9

@jaywilliams
Copy link
Contributor

@jaywilliams jaywilliams commented on 32ca5c9 Apr 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this PHP 7 fix not included in v2.0.4?

Update: This fix is still not included as of v2.0.6

@dengfan
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this PHP 7 fix not included in v2.0.4?

@Krapulat
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix works perfectly. Why not in 2.0.4?

@snez
Copy link

@snez snez commented on 32ca5c9 Apr 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 needs merging into 2.0.x

@mcspronko
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth merging the fix into 2.0.5 release

@peec
Copy link

@peec peec commented on 32ca5c9 Apr 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problems here, im on 2.0.4. and Braintree is not visible.

@rudik99
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this file stored if you installed via composer? I can't see lib/internal/Magento/Framework/App/Config/Data.php in my install ?

@jaywilliams
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rkhoury82 composer installs this file here: vendor/magento/framework/App/Config/Data.php

@liquidia
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its till not solved in 2.06 my backend crashes everything i enable braintree payment module.

@Whaaaaat
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here in Magento 2.1.0 , with FedEx :(
And I can't find "lib/internal/Magento/Framework/App/Config/Data.php" nor changing "vendor/magento/framework/App/Config/Data.php" helped!

Please rescue this is the only shipment method available in my country

this is what I have in my debug.log:

'result' => stdClass::__set_state(array( 'HighestSeverity' => 'WARNING', 'Notifications' => stdClass::__set_state(array( 'Severity' => 'WARNING', 'Source' => 'crs', 'Code' => '556', 'Message' => 'There are no valid services available. ', 'LocalizedMessage' => 'There are no valid services available. ', ))

@kreativedev
Copy link
Contributor

@kreativedev kreativedev commented on 32ca5c9 Dec 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates on this being fixed? Backend still crashing when enabling braintree with EE 2.1.2 and PHP7

@zaietsv
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the same error on magento 2.5 -> 2.6 upgrade http://screenshots.collabstar.com/vza/8a59c378.png

Please sign in to comment.