mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-10 23:41:23 +02:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04c247e0d1 | ||
|
|
eadec6a3d7 | ||
|
|
c304af8636 | ||
|
|
2e03a1caff | ||
|
|
7d40a092ac | ||
|
|
59bbac53bd | ||
|
|
c3de6dc4c8 | ||
|
|
29fbed40d2 | ||
|
|
6b748d24ba | ||
|
|
d0d1698963 |
@@ -6,14 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
- Fixed argument must be passed by reference error introduced in v4.5.1 [#964](https://github.com/smarty-php/smarty/issues/964)
|
|
||||||
|
|
||||||
## [4.5.1] - 2024-03-18
|
|
||||||
|
|
||||||
|
|
||||||
## [4.5.0] - 2024-03-18
|
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Using unregistered static class methods in expressions now also triggers a deprecation notice because we will drop support for this in the next major release [#813](https://github.com/smarty-php/smarty/issues/813)
|
- Using unregistered static class methods in expressions now also triggers a deprecation notice because we will drop support for this in the next major release [#813](https://github.com/smarty-php/smarty/issues/813)
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '4.5.2';
|
const SMARTY_VERSION = '4.4.1';
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -640,18 +640,17 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
|||||||
return $func_name . '(' . $parameter[ 0 ] . ')';
|
return $func_name . '(' . $parameter[ 0 ] . ')';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$first_param = array_shift($parameter);
|
||||||
if (
|
$modifier = array_merge(array($name), $parameter);
|
||||||
!$this->smarty->loadPlugin('smarty_modifiercompiler_' . $name)
|
// Now, compile the function call as a modifier
|
||||||
&& !isset($this->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$name])
|
return $this->compileTag(
|
||||||
&& !in_array($name, ['time', 'join', 'is_array', 'in_array'])
|
'private_modifier',
|
||||||
) {
|
array(),
|
||||||
trigger_error('Using unregistered function "' . $name . '" in a template is deprecated and will be ' .
|
array(
|
||||||
'removed in a future release. Use Smarty::registerPlugin to explicitly register ' .
|
'modifierlist' => array($modifier),
|
||||||
'a custom modifier.', E_USER_DEPRECATED);
|
'value' => $first_param
|
||||||
}
|
)
|
||||||
|
);
|
||||||
return $name . '(' . implode(',', $parameter) . ')';
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->trigger_template_error("unknown function '{$name}'");
|
$this->trigger_template_error("unknown function '{$name}'");
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ php utilities/update-smarty-version-number.php $1
|
|||||||
git add changelog CHANGELOG.md libs/Smarty.class.php
|
git add changelog CHANGELOG.md libs/Smarty.class.php
|
||||||
git commit -m "version bump"
|
git commit -m "version bump"
|
||||||
|
|
||||||
git checkout support/4
|
git checkout support/4.3
|
||||||
git pull
|
git pull
|
||||||
git merge --no-ff "release/$1"
|
git merge --no-ff "release/$1"
|
||||||
git branch -d "release/$1"
|
git branch -d "release/$1"
|
||||||
|
|||||||
@@ -299,12 +299,4 @@ class ScopeTest extends PHPUnit_Smarty
|
|||||||
$this->smarty->assign('scope', 'none');
|
$this->smarty->assign('scope', 'none');
|
||||||
$r = $this->smarty->fetch('test_function_scope.tpl');
|
$r = $this->smarty->fetch('test_function_scope.tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFunctionScopeIsLocalByDefault()
|
|
||||||
{
|
|
||||||
$r = $this->smarty->fetch('string:{function name=test}{$var="b"}{/function}{$var="a"}{test}{$var}');
|
|
||||||
$this->assertEquals('a', $r);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class ArgumentMustBePassedByReference961Test extends PHPUnit_Smarty
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group issue961
|
|
||||||
*/
|
|
||||||
public function testReset()
|
|
||||||
{
|
|
||||||
$smarty = new Smarty();
|
|
||||||
$smarty->registerPlugin('modifier', 'reset', 'reset');
|
|
||||||
$templateStr = "string:{reset(\$ar)}";
|
|
||||||
$smarty->assign('ar', [1,2,3]);
|
|
||||||
$this->assertEquals(
|
|
||||||
'1',
|
|
||||||
$smarty->fetch($templateStr)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group issue961
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
public function testResetAsModifier()
|
|
||||||
{
|
|
||||||
$smarty = new Smarty();
|
|
||||||
try {
|
|
||||||
$templateStr = "string:{\$ar|reset}";
|
|
||||||
$smarty->assign('ar', [1,2,3]);
|
|
||||||
$this->assertEquals(
|
|
||||||
'1',
|
|
||||||
$smarty->fetch($templateStr)
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group issue961
|
|
||||||
*/
|
|
||||||
public function testResetInExpression()
|
|
||||||
{
|
|
||||||
$smarty = new Smarty();
|
|
||||||
$smarty->registerPlugin('modifier', 'reset', 'reset');
|
|
||||||
$templateStr = "string:{if reset(\$ar)}ok{/if}";
|
|
||||||
$smarty->assign('ar', [1,2,3]);
|
|
||||||
$this->assertEquals(
|
|
||||||
'ok',
|
|
||||||
$smarty->fetch($templateStr)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group issue961
|
|
||||||
*/
|
|
||||||
public function testMatch()
|
|
||||||
{
|
|
||||||
$smarty = new Smarty();
|
|
||||||
$smarty->registerPlugin('modifier', 'preg_match', 'preg_match');
|
|
||||||
$templateStr = 'string:{assign var="match" value=null}{if preg_match(\'/([a-z]{4})/\', "a test", $match)}{$match.1}{/if}';
|
|
||||||
$this->assertEquals(
|
|
||||||
'test',
|
|
||||||
$smarty->fetch($templateStr)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user