Skip to content

Commit 3207c4e

Browse files
author
Volodymyr Kublytskyi
committed
MAGETWO-53293: Remove PHP 5.5 from supported versions
- added call to array_values method before ... operator to prevent fatal error "Fatal error: Uncaught Error: Cannot unpack array with string keys"
1 parent 9ff3bda commit 3207c4e

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

Diff for: app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/OptionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ protected function setUp()
289289
];
290290

291291
$modelClassName = \Magento\CatalogImportExport\Model\Import\Product\Option::class;
292-
$this->model = new $modelClassName(...$modelClassArgs);
292+
$this->model = new $modelClassName(...array_values($modelClassArgs));
293293
// Create model mock with rewritten _getMultiRowFormat method to support test data with the old format.
294294
$this->modelMock = $this->getMockBuilder($modelClassName)
295295
->setConstructorArgs($modelClassArgs)

Diff for: app/code/Magento/Quote/Model/ShippingAddressManagement.php

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres
9797
$quote->setShippingAddress($address);
9898
$address = $quote->getShippingAddress();
9999

100+
if ($customerAddressId === null) {
101+
$address->setCustomerAddressId(null);
102+
}
103+
100104
if ($customerAddressId) {
101105
$addressData = $this->addressRepository->getById($customerAddressId);
102106
$address = $quote->getShippingAddress()->importCustomerAddressData($addressData);

Diff for: lib/internal/Magento/Framework/Filter/Input.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ protected function _createNativeZendFilter($filterData)
344344
if (is_string($filter)) {
345345
$filterClassName = 'Zend_Filter_' . ucfirst($filter);
346346
$filterClassOptions = isset($filterData['args']) ? $filterData['args'] : [];
347-
$filter = new $filterClassName(...$filterClassOptions);
347+
$filter = new $filterClassName(...array_values($filterClassOptions));
348348
}
349349

350350
if (!$filter instanceof \Zend_Filter_Interface) {

Diff for: lib/internal/Magento/Framework/Interception/Chain/Chain.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function invokeNext(
4949
foreach ($pluginInfo[DefinitionInterface::LISTENER_BEFORE] as $code) {
5050
$pluginInstance = $this->pluginList->getPlugin($type, $code);
5151
$pluginMethod = 'before' . $capMethod;
52-
$beforeResult = $pluginInstance->$pluginMethod($subject, ...$arguments);
52+
$beforeResult = $pluginInstance->$pluginMethod($subject, ...array_values($arguments));
5353
if ($beforeResult) {
5454
$arguments = $beforeResult;
5555
}
@@ -64,7 +64,7 @@ public function invokeNext(
6464
};
6565
$pluginInstance = $this->pluginList->getPlugin($type, $code);
6666
$pluginMethod = 'around' . $capMethod;
67-
$result = $pluginInstance->$pluginMethod($subject, $next, ...$arguments);
67+
$result = $pluginInstance->$pluginMethod($subject, $next, ...array_values($arguments));
6868
unset($pluginInstance, $pluginMethod);
6969
} else {
7070
$result = $subject->___callParent($method, $arguments);

Diff for: lib/internal/Magento/Framework/Interception/Interceptor.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function ___init()
7171
*/
7272
public function ___callParent($method, array $arguments)
7373
{
74-
return parent::$method(...$arguments);
74+
return parent::$method(...array_values($arguments));
7575
}
7676

7777
/**
@@ -120,7 +120,7 @@ protected function ___callPlugins($method, array $arguments, array $pluginInfo)
120120
foreach ($pluginInfo[DefinitionInterface::LISTENER_BEFORE] as $code) {
121121
$pluginInstance = $this->pluginList->getPlugin($this->subjectType, $code);
122122
$pluginMethod = 'before' . $capMethod;
123-
$beforeResult = $pluginInstance->$pluginMethod($this, ...$arguments);
123+
$beforeResult = $pluginInstance->$pluginMethod($this, ...array_values($arguments));
124124
if ($beforeResult) {
125125
$arguments = $beforeResult;
126126
}
@@ -139,11 +139,11 @@ protected function ___callPlugins($method, array $arguments, array $pluginInfo)
139139
};
140140
$pluginInstance = $this->pluginList->getPlugin($this->subjectType, $code);
141141
$pluginMethod = 'around' . $capMethod;
142-
$result = $pluginInstance->$pluginMethod($this, $next, ...$arguments);
142+
$result = $pluginInstance->$pluginMethod($this, $next, ...array_values($arguments));
143143
unset($pluginInstance, $pluginMethod);
144144
} else {
145145
// Call original method
146-
$result = parent::$method(...$arguments);
146+
$result = parent::$method(...array_values($arguments));
147147
}
148148
if (isset($pluginInfo[DefinitionInterface::LISTENER_AFTER])) {
149149
// Call 'after' listeners

Diff for: lib/internal/Magento/Framework/ObjectManager/Factory/AbstractFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function setArguments($arguments)
9090
*/
9191
protected function createObject($type, $args)
9292
{
93-
return new $type(...$args);
93+
return new $type(...array_values($args));
9494
}
9595

9696
/**

Diff for: lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function ($className, $arguments) {
217217
}
218218
}
219219
}
220-
return new $className(...$args);
220+
return new $className(...array_values($args));
221221
}
222222
));
223223

Diff for: setup/src/Magento/Setup/Test/Unit/Module/I18n/Dictionary/PhraseTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class PhraseTest extends \PHPUnit_Framework_TestCase
1717
*/
1818
public function testPhraseCreation($constructArguments, $getter, $result)
1919
{
20-
$phrase = new Phrase(...$constructArguments);
20+
$phrase = new Phrase(...array_values($constructArguments));
2121
$this->assertEquals($result, $phrase->{$getter}());
2222
}
2323

@@ -57,7 +57,7 @@ public function testWrongParametersWhilePhraseCreation($constructArguments, $mes
5757
{
5858
$this->setExpectedException('DomainException', $message);
5959

60-
new Phrase(...$constructArguments);
60+
new Phrase(...array_values($constructArguments));
6161
}
6262

6363
/**

0 commit comments

Comments
 (0)