Skip to content

Firefly III: a personal finances manager

Fix https://github.com/firefly-iii/firefly-iii/issues/11976

James Cole3a971d738cf1
diff --git a/app/Api/V1/Requests/Models/Rule/StoreRequest.php b/app/Api/V1/Requests/Models/Rule/StoreRequest.php
index 72cd9f727c..02a1167d04 100644
--- a/app/Api/V1/Requests/Models/Rule/StoreRequest.php
+++ b/app/Api/V1/Requests/Models/Rule/StoreRequest.php
@@ -51,7 +51,7 @@ class StoreRequest extends FormRequest
{
$fields = [
'title' => ['title', 'convertString'],
- 'description' => ['description', 'convertString'],
+ 'description' => ['description', 'stringWithNewlines'],
'rule_group_id' => ['rule_group_id', 'convertInteger'],
'order' => ['order', 'convertInteger'],
'rule_group_title' => ['rule_group_title', 'convertString'],
diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php
index 792ba25bd2..94ccca0233 100644
--- a/app/Support/Request/ConvertsDataTypes.php
+++ b/app/Support/Request/ConvertsDataTypes.php
@@ -235,7 +235,12 @@ trait ConvertsDataTypes
*/
public function stringWithNewlines(string $field): string
{
- return (string) $this->clearStringKeepNewlines((string) ($this->get($field) ?? ''));
+ $entry = $this->get($field);
+ if (!is_scalar($entry)) {
+ return '';
+ }
+
+ return (string) $this->clearStringKeepNewlines((string) $entry);
}
/**