From 85ad9711f118c9a2a249d5eeecebd1e4a054c40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 2 Jun 2026 14:42:55 +0200 Subject: [PATCH] fix: drop errors in form submissions to myep api silently --- .../ep_theme/Classes/Form/BpnApiFinisher.php | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/public/typo3conf/ext/ep_theme/Classes/Form/BpnApiFinisher.php b/public/typo3conf/ext/ep_theme/Classes/Form/BpnApiFinisher.php index 7f5cf3bf..4b7cea0b 100644 --- a/public/typo3conf/ext/ep_theme/Classes/Form/BpnApiFinisher.php +++ b/public/typo3conf/ext/ep_theme/Classes/Form/BpnApiFinisher.php @@ -23,16 +23,31 @@ class BpnApiFinisher extends AbstractFinisher protected function executeInternal() { - $values = []; - $formValues = $this->finisherContext->getFormValues(); - $mappingOption = $this->parseOption('mapping'); - $mappings = GeneralUtility::trimExplode(',', $mappingOption, true); - foreach ($mappings as $mapping) { - [$remote, $local] = GeneralUtility::trimExplode(':', $mapping); - $values[$remote] = $formValues[$local]; - } - if (count($values) > 0) { - $this->apiClient->registerAddress($values); + try { + $values = []; + $formValues = $this->finisherContext->getFormValues(); + $mappingOption = (string)$this->parseOption('mapping'); + $mappings = GeneralUtility::trimExplode(',', $mappingOption, true); + + foreach ($mappings as $mapping) { + $parts = GeneralUtility::trimExplode(':', $mapping, true, 2); + if (2 !== count($parts)) { + continue; + } + + [$remote, $local] = $parts; + if ('' === $remote || '' === $local || false === array_key_exists($local, $formValues)) { + continue; + } + + $values[$remote] = $formValues[$local]; + } + + if ([] !== $values) { + $this->apiClient->registerAddress($values); + } + } catch (\Throwable $e) { + // Intentionally ignore all errors so the form submission stays silent. } } }