Skip to content

Commit cb2bcc4

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-61232' into BUGS-2.0
2 parents f6e5678 + 02b3a94 commit cb2bcc4

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 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,24 @@ 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
*/
307307
protected function _implodeArrayValues($value)
308308
{
309-
if (is_array($value) && count($value)) {
310-
$isScalar = false;
309+
if (is_array($value)) {
310+
$isScalar = true;
311311
foreach ($value as $val) {
312-
if (is_scalar($val)) {
313-
$isScalar = true;
312+
if (!is_scalar($val)) {
313+
$isScalar = false;
314314
}
315315
}
316+
316317
if ($isScalar) {
317318
$value = trim(implode("\n", $value));
318319
}
319320
}
321+
320322
return $value;
321323
}
322324

0 commit comments

Comments
 (0)