Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check for empty postParseEvent ccda import #7348

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Services/Cda/CdaTemplateParse.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public function parseCDAEntryComponents($components): array
}
}
}
$this->templateData = $postParseEvent->getTemplateData();
if (!empty($postParseEvent)) {
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does empty() function work on objects?

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be safer to check the instance type. Empty will work, but if someone returns a string or something other than an object having a getTemplateData() method this will blow up

if ($postParseEvent instanceof CDAPostParseEvent)

$this->templateData = $postParseEvent->getTemplateData();
}
}
return $this->templateData;
}
Expand Down