🚑 fix(templates) Fix date modifier

Date modifier was returning an array of array instead of an array of
 strings, causing problems later on.

issue #6064
parent 890c1f97
......@@ -411,7 +411,7 @@ class templateHandling
}
}
return $res;
return [$res];
}
private static function modifierDate (array $args)
......@@ -561,11 +561,11 @@ class templateHandling
break;
case 'r':
// random string
$result = [static::modifierRandomString($args)];
$result = static::modifierRandomString($args);
break;
case 'd':
// date
$result = [static::modifierDate($args)];
$result = static::modifierDate($args);
break;
case 'n':
// number
......
......@@ -1968,18 +1968,18 @@ function fopenWithErrorHandling (...$args)
// Check to see if it exists in case PHP has this function later
if (!function_exists('mb_substr_replace')) {
// Same parameters as substr_replace with the extra encoding parameter
function mb_substr_replace ($string, $replacement, $start, $length = NULL, $encoding = NULL)
function mb_substr_replace (string $string, string $replacement, $start, $length = NULL, $encoding = NULL)
{
if ($encoding == NULL) {
if ($encoding === NULL) {
$encoding = mb_internal_encoding();
}
if ($length == NULL) {
if ($length === NULL) {
return mb_substr($string, 0, $start, $encoding).
$replacement;
} else {
return mb_substr($string, 0, $start, $encoding).
$replacement.
mb_substr($string, $start + $length, mb_strlen($string, $encoding), $encoding);
mb_substr($string, $start + $length, NULL, $encoding);
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment