This commit is contained in:
Laurent Destailleur
2026-01-30 13:21:27 +01:00
parent 00bc3e60d9
commit 4fd58bf4ea

View File

@@ -2244,10 +2244,10 @@ function dolSlugify($stringtoslugify)
/**
* Returns text escaped for inclusion into javascript code
*
* @param string $stringtoescape String to escape
* @param int<0,3> $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \
* @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n.
* @return string Escaped string. Both ' and " are escaped into ' if they are escaped.
* @param int|string $stringtoescape String to escape
* @param int<0,3> $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \
* @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n.
* @return string Escaped string. Both ' and " are escaped into ' if they are escaped.
*/
function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0)
{
@@ -2273,7 +2273,7 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0)
$substitjs["'"] = "\\'";
$substitjs['"'] = "\\\"";
}
return strtr($stringtoescape, $substitjs);
return strtr((string) $stringtoescape, $substitjs);
}
/**