mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 09:54:27 +02:00
Merge branch 'master' into smarty5
This commit is contained in:
@@ -21,7 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- `$smarty->muteUndefinedOrNullWarnings()` now also mutes PHP7 notices for undefined array indexes [#736](https://github.com/smarty-php/smarty/issues/736)
|
||||
- `$smarty->muteUndefinedOrNullWarnings()` now treats undefined vars and array access of a null or false variables
|
||||
equivalent across all supported PHP versions
|
||||
- `$smarty->muteUndefinedOrNullWarnings()` now allows dereferencing of non-objects accross all supported PHP versions [#831](https://github.com/smarty-php/smarty/issues/831)
|
||||
- `$smarty->muteUndefinedOrNullWarnings()` now allows dereferencing of non-objects across all supported PHP versions [#831](https://github.com/smarty-php/smarty/issues/831)
|
||||
- PHP 8.1 deprecation warnings on null strings in modifiers [#834](https://github.com/smarty-php/smarty/pull/834)
|
||||
|
||||
## [4.3.0] - 2022-11-22
|
||||
|
||||
### Added
|
||||
@@ -43,7 +45,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Adapt Smarty upper/lower functions to be codesafe (e.g. for Turkish locale) [#586](https://github.com/smarty-php/smarty/pull/586)
|
||||
- Bug fix for underscore and limited length in template name in custom resources [#581](https://github.com/smarty-php/smarty/pull/581)
|
||||
|
||||
|
||||
## [4.2.1] - 2022-09-14
|
||||
|
||||
### Security
|
||||
|
@@ -14,7 +14,7 @@ namespace Smarty\Compile\Modifier;
|
||||
class LowerModifierCompiler extends Base {
|
||||
|
||||
public function compile($params, \Smarty\Compiler\Template $compiler) {
|
||||
return 'mb_strtolower(' . $params[ 0 ] . ', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||
return 'mb_strtolower((string) ' . $params[ 0 ] . ', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||
}
|
||||
|
||||
}
|
@@ -13,7 +13,7 @@ namespace Smarty\Compile\Modifier;
|
||||
class UpperModifierCompiler extends Base {
|
||||
|
||||
public function compile($params, \Smarty\Compiler\Template $compiler) {
|
||||
return 'mb_strtoupper(' . $params[ 0 ] . ' ?? \'\', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||
return 'mb_strtoupper((string) ' . $params[ 0 ] . ' ?? \'\', \'' . addslashes(\Smarty\Smarty::$_CHARSET) . '\')';
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -651,7 +651,7 @@ class DefaultExtension extends Base {
|
||||
*/
|
||||
public function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
|
||||
{
|
||||
if ($length === 0) {
|
||||
if ($length === 0 || $string === null) {
|
||||
return '';
|
||||
}
|
||||
if (mb_strlen($string, \Smarty\Smarty::$_CHARSET) > $length) {
|
||||
|
@@ -62,7 +62,7 @@ class TrimWhitespace implements \Smarty\Filter\FilterInterface {
|
||||
}
|
||||
}
|
||||
$expressions = array(// replace multiple spaces between tags by a single space
|
||||
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
|
||||
// can't remove them entirely, because that might break poorly implemented CSS display:inline-block elements
|
||||
'#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
|
||||
// remove spaces between attributes (but not in attribute values!)
|
||||
'#(([a-z0-9]\s*=\s*("[^"]*?")|(\'[^\']*?\'))|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \5',
|
||||
|
@@ -183,7 +183,7 @@ function smarty_mb_str_replace($search, $replace, $subject, &$count = 0)
|
||||
function smarty_function_escape_special_chars($string)
|
||||
{
|
||||
if (!is_array($string)) {
|
||||
$string = htmlspecialchars($string, ENT_COMPAT, \Smarty\Smarty::$_CHARSET, false);
|
||||
$string = htmlspecialchars((string) $string, ENT_COMPAT, \Smarty\Smarty::$_CHARSET, false);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
@@ -1,6 +0,0 @@
|
||||
{function 'nocache1' default1='d1' default2='d2'}
|
||||
default1={$default1}
|
||||
default2={$default1 nocache}
|
||||
p1={$p1}
|
||||
p2={$p2 nocache}
|
||||
{/function}
|
@@ -1,4 +0,0 @@
|
||||
Test 1
|
||||
<br/>
|
||||
{include 'test7.tpl' compile_id = 4}
|
||||
|
@@ -1,7 +0,0 @@
|
||||
Test 1
|
||||
<br/>
|
||||
{include 'test7.tpl' compile_id = $id}
|
||||
{include 'test6.tpl'}
|
||||
{include file="test2.tpl"}
|
||||
{include 'test6.tpl'}
|
||||
|
@@ -1,3 +0,0 @@
|
||||
Test 2
|
||||
<br/>
|
||||
{include file="test3.tpl" compile_id=4}
|
@@ -1,4 +0,0 @@
|
||||
Test 3 {call name='f' nocache}
|
||||
<br/>
|
||||
{include file="test4.tpl" compile_id=9}
|
||||
{include file="test5.tpl" cache_id="7"}
|
@@ -1,3 +0,0 @@
|
||||
Test 4
|
||||
<br/>
|
||||
{include file="test5.tpl" cache_id="7"}
|
@@ -1,4 +0,0 @@
|
||||
test 5
|
||||
<br>
|
||||
|
||||
{call 'f'}
|
@@ -1,8 +0,0 @@
|
||||
test 6
|
||||
<br>
|
||||
{function name='f'}
|
||||
<br>
|
||||
function f {$id} {$foo}
|
||||
<br>
|
||||
{/function}
|
||||
<br> Time 6 = {$t6}<br>
|
@@ -1,2 +0,0 @@
|
||||
test 7
|
||||
<br> extern
|
Reference in New Issue
Block a user