Commit 6a95a002 authored by Dries's avatar Dries

- Patch #7058 by Neil: format_date does not properly handle escaped characters.

parent d3fb126d
......@@ -789,7 +789,9 @@ function format_interval($timestamp, $granularity = 2) {
* The format to use. Can be "small", "medium" or "large" for the preconfigured
* date formats. If "custom" is specified, then $format is required as well.
* @param $format
* A PHP date format string as required by date().
* A PHP date format string as required by date(). A backslash should be used
* before a character to avoid interpreting the character as part of a date
* format.
* @param $timezone
* Time zone offset in seconds; if omitted, the user's time zone is used.
* @return
......@@ -842,6 +844,9 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
else if ($c == 'Z') {
$date .= $timezone;
}
else if ($c == '\\') {
$date .= $format[++$i];
}
else {
$date .= $c;
}
......
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