diff --git a/src/core/Directus/Util/StringUtils.php b/src/core/Directus/Util/StringUtils.php index 9fea33259f..0ea7bed5ee 100644 --- a/src/core/Directus/Util/StringUtils.php +++ b/src/core/Directus/Util/StringUtils.php @@ -233,6 +233,12 @@ public static function replacePlaceholder($string, $data = [], $placeHolderForma } } + /** + * If any variable of the given string have null value as a replacement then the + * result will be 'null'(string). So we need to replace it with blank string. + */ + $string = str_replace("'null'", "''", $string); + // convert all remaining optionals placeholder from {{optional(key)}} to // 'key' => '' $pattern = '#^(.*)({{optional\((.*)\)}})(.*\n)?#im'; $string = preg_replace_callback($pattern, function ($matches) use ($keyName) {