From 67a0dc81311cb461cf674996834f203ebf8aa3a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 5 Jan 2020 21:09:19 +0100 Subject: [PATCH] Fixed exceptions occuring cause of strict_types. --- src/Form/Type/SIUnitType.php | 2 +- src/Services/Attachments/AttachmentManager.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Form/Type/SIUnitType.php b/src/Form/Type/SIUnitType.php index 3a848396..a22ba234 100644 --- a/src/Form/Type/SIUnitType.php +++ b/src/Form/Type/SIUnitType.php @@ -160,7 +160,7 @@ class SIUnitType extends AbstractType implements DataMapperInterface return null; } - $data = $this->si_formatter->convertValue($viewData); + $data = $this->si_formatter->convertValue((float) $viewData); if (isset($forms['prefix'])) { $forms['value']->setData($data['value']); diff --git a/src/Services/Attachments/AttachmentManager.php b/src/Services/Attachments/AttachmentManager.php index e898db0e..ffaac0d5 100644 --- a/src/Services/Attachments/AttachmentManager.php +++ b/src/Services/Attachments/AttachmentManager.php @@ -105,7 +105,13 @@ class AttachmentManager return false; } - return file_exists($this->toAbsoluteFilePath($attachment)) || $attachment->isExternal(); + $absolute_path = $this->toAbsoluteFilePath($attachment); + + if ($absolute_path === null) { + return false; + } + + return file_exists($absolute_path) || $attachment->isExternal(); } /**