Skip to content

Commit

Permalink
Fix error when no recipients are given
Browse files Browse the repository at this point in the history
When having chosen the database method no recipients are given resulting in an error from the formatRecipients function
Changed the function to only run when recipients are provided
  • Loading branch information
alessandrocraeye committed Jan 16, 2024
1 parent 2fb228f commit fcaa17e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/Backend/Modules/FormBuilder/Engine/Model.php
Expand Up @@ -285,17 +285,21 @@ public static function existsIdentifier(string $identifier, int $ignoreId = null
*
* @param string $string The serialized string that should be formatted
*
* @return string
* @return string|null
*/
public static function formatRecipients(string $string): string
public static function formatRecipients(string $string): ?string
{
return implode(
', ',
(array) array_map(
'htmlspecialchars',
@unserialize($string, ['allowed_classes' => false])
)
);
if ($string) {
return implode(
', ',
(array)array_map(
'htmlspecialchars',
@unserialize($string, ['allowed_classes' => false])
)
);
}

return null;
}

/**
Expand Down

0 comments on commit fcaa17e

Please sign in to comment.