senaranya / HL7

PHP library for Parsing, Generation and Sending HL7 v2 messages
MIT License
183 stars 86 forks source link

Array to string conversion when processing ADT message #77

Open maxxer opened 2 years ago

maxxer commented 2 years ago

Processing the following message (and calling toString()) throws Array to string conversion in src/HL7/Message.php:388:

MSH|^~\&|SAC|PIVA|DIP_SAC|Dipartimentale|20190531204652||ADT^A40|0d9834c0-6efa-4153-aa10-e349017057c9|P|2.5
EVN||20190531204652
PID|||D298B31F-53E2-4FCD-9246-240B61792023^55^^PK~9143224^^^ABC|| COGNOME^NOME||19310525|F|||&VIA   MEUCCI 3^^020066^^46019^^H~&VIA   MEUCCI 3^^020066^^46019^^L~&^^020035^^^^BDL||^^PH~^^CP|||||CF|7289721||||020035|||||100^Italia
MRG|936815CB-75C2-45BD-BBB7-F5BEACED3D63
maxxer commented 2 years ago

This can be avoided by setting doNotSplitRepetition to true.

senaranya commented 2 years ago

That's true. Let me know if doNotSplitRepetition is not giving you the desired output. If it's working for you, we can close the ticket

maxxer commented 2 years ago

Yes, using it is a solution to me, but I was wondering if that's a correct behavior. If the library splits the field into subcomponents, then why isn't it able to recompose it later on to build the string?