File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
app/code/Magento/Customer/Model/Address Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -263,7 +263,7 @@ public function setData($key, $value = null)
263
263
{
264
264
if (is_array ($ key )) {
265
265
$ key = $ this ->_implodeArrayField ($ key );
266
- } elseif (is_array ($ value ) && ! empty ( $ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
266
+ } elseif (is_array ($ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
267
267
$ value = $ this ->_implodeArrayValues ($ value );
268
268
}
269
269
return parent ::setData ($ key , $ value );
@@ -291,7 +291,7 @@ protected function isAddressMultilineAttribute($code)
291
291
protected function _implodeArrayField (array $ data )
292
292
{
293
293
foreach ($ data as $ key => $ value ) {
294
- if (is_array ($ value ) && ! empty ( $ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
294
+ if (is_array ($ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
295
295
$ data [$ key ] = $ this ->_implodeArrayValues ($ data [$ key ]);
296
296
}
297
297
}
@@ -301,22 +301,24 @@ protected function _implodeArrayField(array $data)
301
301
/**
302
302
* Combine values of field lines into a single string
303
303
*
304
- * @param string[]|string $value
304
+ * @param array $value
305
305
* @return string
306
306
*/
307
307
protected function _implodeArrayValues ($ value )
308
308
{
309
- if (is_array ($ value ) && count ( $ value ) ) {
310
- $ isScalar = false ;
309
+ if (is_array ($ value )) {
310
+ $ isScalar = true ;
311
311
foreach ($ value as $ val ) {
312
- if (is_scalar ($ val )) {
313
- $ isScalar = true ;
312
+ if (! is_scalar ($ val )) {
313
+ $ isScalar = false ;
314
314
}
315
315
}
316
+
316
317
if ($ isScalar ) {
317
318
$ value = trim (implode ("\n" , $ value ));
318
319
}
319
320
}
321
+
320
322
return $ value ;
321
323
}
322
324
You can’t perform that action at this time.
0 commit comments