Skip to content

Handle components/subcomponents within hl7version field (MSH-12) - #144

Merged
senaranya merged 4 commits into
senaranya:masterfrom
pcorrick:master
May 4, 2026
Merged

senaranya merged 4 commits into
senaranya:masterfrom
pcorrick:master

Conversation

@pcorrick

Copy link
Copy Markdown
Contributor

When the MSH-12 field (HL7 version) has components, getField(12) returns an array which causes a type error with $this->hl7Version (which is a string)

@senaranya

Copy link
Copy Markdown
Owner

Please add test(s) that'd fail without the fix

@pcorrick

pcorrick commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

Please add test(s) that'd fail without the fix

Sure, I gave it a go

@senaranya

Copy link
Copy Markdown
Owner

Thank you for the test. Can you please replace the reflection though (as the implementation of the Message class may change in future). May be to this:

$msg = new Message("MSH|^~\\&||||||||||2.7^NZL&1.0\r");
self::assertSame("MSH|^~\&||||||||||2.7^NZL&1.0|\n", $msg->toString(true));

Also, a stray phpunit cache file got pushed in the commit, please remove it.

@pcorrick

pcorrick commented May 2, 2026

Copy link
Copy Markdown
Contributor Author

ok thanks I have made those adjustments

@senaranya
senaranya merged commit 3d7aeec into senaranya:master May 4, 2026
4 checks passed
@senaranya

Copy link
Copy Markdown
Owner

Merged. Thank you for the fix and the PR. Appreciate your help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants