feat: harden xml parsing to avoid uncaught errors

This commit is contained in:
Björn Fromme committed 2026-03-20 12:14:02 +01:00
1 parent 3849ae306c
commit 3234c78f0d
9 files changed
+229 -147

No files matched your search

@@ -11,8 +11,12 @@ class ContactFormResponseParser extends AbstractParser
{
public function parse(Crawler $node): RegistrationResponse
{
$addressId = (int) $node->filterXPath('//idadresse')->text();
$personId = (int) $node->filterXPath('//idperson')->text();
$addressId = $this->getIntOrNullValue($node->filterXPath('//idadresse'));
$personId = $this->getIntOrNullValue($node->filterXPath('//idperson'));
if (null === $addressId || null === $personId) {
throw new \InvalidArgumentException('Missing required idadresse or idperson in contact form response.');
}
$isNewRecord = $this->getBoolValue($node->filterXPath('//neuanlage'));
return new RegistrationResponse(