Upgrade from Smarty 3 to Smarty 4 to be PHP 8.1 compatible

Remove all Smarty4 dedicated tests, all are done in the same test file
like before
This commit is contained in:
Clemens Schwaighofer
2022-04-06 15:12:50 +09:00
parent 4b0e9b44c3
commit f8ee6044f9
478 changed files with 33447 additions and 12496 deletions

View File

@@ -0,0 +1,32 @@
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifierCompiler
*/
/**
* Smarty default modifier plugin
* Type: modifier
* Name: default
* Purpose: designate default value for empty variables
*
* @link https://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
* @author Uwe Tews
*
* @param array $params parameters
*
* @return string with compiled code
*/
function smarty_modifiercompiler_default($params)
{
$output = $params[ 0 ];
if (!isset($params[ 1 ])) {
$params[ 1 ] = "''";
}
array_shift($params);
foreach ($params as $param) {
$output = '(($tmp = ' . $output . ' ?? null)===null||$tmp===\'\' ? ' . $param . ' ?? null : $tmp)';
}
return $output;
}