Skip to content

Commit a1b539c

Browse files
committed
Fix edge case in Encoder with DGS segments
1 parent 594112d commit a1b539c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/EDI/Encoder.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public function encodeSegment($row)
8585
if (!is_array($row[$i])) {
8686
$elm = $this->escapeValue($row[$i]);
8787
} else {
88+
if (count($row[$i]) == 1 && is_array(reset($row[$i]))) {
89+
$row[$i] = array_pop($row[$i]);
90+
}
8891
foreach ($row[$i] as &$temp) {
8992
$temp = $this->escapeValue($temp);
9093
}

src/EDI/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,4 @@ public function getMessageDirectory()
389389
{
390390
return $this->messageDirectory;
391391
}
392-
}
392+
}

0 commit comments

Comments
 (0)