Compare commits

...

5 Commits

Author SHA1 Message Date
Simon Wisselink c1642490f0 Added some unit test to study consistent behavior on passing argument by reference. 2024-04-05 17:04:03 +02:00
Simon Wisselink 2fc443806c Merge branch 'release/3.1.48' into support/3.1 2023-03-28 21:45:54 +02:00
Simon Wisselink e4cbb1ddc1 version bump 2023-03-28 21:45:52 +02:00
Simon Wisselink df9b93df67 Add changelog 2023-03-28 21:43:12 +02:00
Simon Wisselink e09df8d851 Merge branch 'js_escape_security_fix_31' into support/3.1 2023-03-28 21:41:31 +02:00
3 changed files with 71 additions and 1 deletions
+5
View File
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [3.1.48] - 2023-03-28
### Security
- Fixed Cross site scripting vulnerability in Javascript escaping. This addresses CVE-2023-28447.
### Fixed
- Output buffer is now cleaned for internal PHP errors as well, not just for Exceptions [#514](https://github.com/smarty-php/smarty/issues/514)
+1 -1
View File
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.47';
const SMARTY_VERSION = '3.1.48';
/**
* define variable scopes
*/
@@ -0,0 +1,65 @@
<?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
*/
public function testResetAsModifier()
{
$smarty = new Smarty();
$templateStr = "string:{\$ar|reset}";
$smarty->assign('ar', [1,2,3]);
$this->assertEquals(
'1',
$smarty->fetch($templateStr)
);
}
/**
* @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
* @deprecated
*/
public function testMatch()
{
$smarty = new Smarty();
$smarty->setErrorReporting(E_ALL & ~ E_USER_DEPRECATED);
$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)
);
}
}