toString on pid 5.3 error exception
svenvanhees opened this issue · 2 comments
svenvanhees commented
When using toString() on a message that has the pid 5.1 field filled in, the segmentToString function returns an ErrorException: Array to string conversion.
Reproducible by using a pid 5.1 like this:
Test &""&firstname &""&""^F^N N^^^^F^^^^""~Test &""&Test^Test^""^^^^B~""&""&""^^^^^^P~^Lastname^^^^^N
The implode function in segmentToString tries to implode the pid 5 field, which looks like this:
array:5 [
0 => array:5 [
0 => "Test "
1 => """"
2 => "firstname "
3 => """"
4 => """"
]
1 => "F"
2 => "N N"
3 => "F"
4 => """"
]
senaranya commented
Try the argument doNotSplitRepetition
while creating Message() object:
$msg = new Message($messageString, null, false, false, true, true); // Or if you're on PHP-8: new Message($messageString, doNotSplitRepetition: true);
svenvanhees commented
That seems to do the trick. Thanks!