Fix strip_tags modifier for falsy input. (#893)

Fixes #890
This commit is contained in:
Simon Wisselink
2023-08-04 22:40:19 +02:00
committed by GitHub
parent 1d9cda2be3
commit a3cbdc46fb
3 changed files with 50 additions and 1 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
function smarty_modifiercompiler_strip_tags($params)
{
if (!isset($params[ 1 ]) || $params[ 1 ] === true || trim($params[ 1 ], '"') === 'true') {
return "preg_replace('!<[^>]*?>!', ' ', {$params[0]} ?: '')";
return "preg_replace('!<[^>]*?>!', ' ', (string) {$params[0]})";
} else {
return 'strip_tags((string) ' . $params[ 0 ] . ')';
}