Skip to content

Commit 25c3c57

Browse files
author
Sergii Kovalenko
committed
MAGETWO-61232: Shipping rates can not be loaded
1 parent 8a1974f commit 25c3c57

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function setData($key, $value = null)
263263
{
264264
if (is_array($key)) {
265265
$key = $this->_implodeArrayField($key);
266-
} elseif (is_array($value) && !empty($value) && $this->isAddressMultilineAttribute($key)) {
266+
} elseif (is_array($value) && $this->isAddressMultilineAttribute($key)) {
267267
$value = $this->_implodeArrayValues($value);
268268
}
269269
return parent::setData($key, $value);
@@ -291,7 +291,7 @@ protected function isAddressMultilineAttribute($code)
291291
protected function _implodeArrayField(array $data)
292292
{
293293
foreach ($data as $key => $value) {
294-
if (is_array($value) && !empty($value) && $this->isAddressMultilineAttribute($key)) {
294+
if (is_array($value) && $this->isAddressMultilineAttribute($key)) {
295295
$data[$key] = $this->_implodeArrayValues($data[$key]);
296296
}
297297
}
@@ -301,22 +301,22 @@ protected function _implodeArrayField(array $data)
301301
/**
302302
* Combine values of field lines into a single string
303303
*
304-
* @param string[]|string $value
304+
* @param array $value
305305
* @return string
306306
*/
307-
protected function _implodeArrayValues($value)
307+
protected function _implodeArrayValues(array $value)
308308
{
309-
if (is_array($value) && count($value)) {
310-
$isScalar = false;
311-
foreach ($value as $val) {
312-
if (is_scalar($val)) {
313-
$isScalar = true;
314-
}
315-
}
316-
if ($isScalar) {
317-
$value = trim(implode("\n", $value));
309+
$isScalar = true;
310+
foreach ($value as $val) {
311+
if (!is_scalar($val)) {
312+
$isScalar = false;
318313
}
319314
}
315+
316+
if ($isScalar) {
317+
$value = trim(implode("\n", $value));
318+
}
319+
320320
return $value;
321321
}
322322

0 commit comments

Comments
 (0)