2
0
forked from Wavyzz/dolibarr

Fix: Resolve gmstrftime by using dol_print_date with

# Fix: Resolve gmstrftime by using dol_print_date with

gmstrftime is deprecated, use dol_print_date with  parameter.
Also update related typing for static check tools.
This commit is contained in:
MDW
2024-01-18 23:11:18 +01:00
parent b128ec6a4b
commit b8d7c1970b

View File

@@ -1372,6 +1372,7 @@ function dol_sanitizeFileName($str, $newstr = '_', $unaccent = 1)
return $tmp;
}
/**
* Clean a string to use it as a path name. Similare to dol_sanitizeFileName but accept / and \ chars.
* Replace also '--' and ' -' strings, they are used for parameters separation (Note: ' - ' is allowed).
@@ -2795,15 +2796,15 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
*
* @param string $fmt Format of strftime function (http://php.net/manual/fr/function.strftime.php)
* @param int $ts Timestamp (If is_gmt is true, timestamp is already includes timezone and daylight saving offset, if is_gmt is false, timestamp is a GMT timestamp and we must compensate with server PHP TZ)
* @param int $is_gmt See comment of timestamp parameter
* @param bool $is_gmt See comment of timestamp parameter
* @return string A formatted string
*/
function dol_strftime($fmt, $ts = false, $is_gmt = false)
{
if ((abs($ts) <= 0x7FFFFFFF)) { // check if number in 32-bit signed range
return ($is_gmt) ? @gmstrftime($fmt, $ts) : @dol_print_date($ts, $fmt);
return dol_print_date($ts, $fmt, $is_gmt);
} else {
return 'Error date into a not supported range';
return 'Error date outside supported range';
}
}
@@ -2818,7 +2819,7 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false)
* "%d/%m/%Y %H:%M:%S",
* "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...inputnoreduce", "...reduceformat"
* @param string $tzoutput true or 'gmt' => string is for Greenwich location
* @param string|bool $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
* 'tzuserrel' => output string is for user TZ (current browser TZ with dst or not, depending on date position)