Compare commits

..

10 Commits

Author SHA1 Message Date
Simon Wisselink f25dd94f9f Incorporated AnrDaemons suggestions, making composer figure out the required phpunit version instead of specifying it explicitly and removing a unneeded error supression (@). 2020-09-12 21:15:58 +02:00
Simon Wisselink d1dcee0d9e run travis in xenial where possible for latest php versions. Fix unit tests from freakingo over inconsistent error messages in php8-beta. 2020-09-11 13:56:51 +02:00
Simon Wisselink 8df47cf030 changelog 2020-09-11 13:30:41 +02:00
Simon Wisselink 6f41b9bfc9 Fixed a unit test that accidentally passed on phpunit < 7 because of sloppy string comparison. 2020-09-11 13:26:00 +02:00
Simon Wisselink 7d48d8692f Fix unit tests for php8, force composer to think we are still php7 to pick a supported phpunit and being less specific about an error msg because PHP8 is in active development and the exact wording is changing. 2020-09-11 12:55:43 +02:00
Simon Wisselink ca2be225d6 Attempt to fix travis runs for (almost) all php versions supported 2020-09-11 11:07:03 +02:00
Simon Wisselink 3b0b48ed3e Updated UndefinedTemplateVarTest for PHP8 (and disabled a check for PHP<5.6) and re-enabled php:nightly in travis config 2020-09-11 10:21:25 +02:00
Simon Wisselink 62dc42b0c5 php5 compat syntax 2020-09-11 00:39:17 +02:00
Simon Wisselink 818aa3c3da Getting ready for PHP8, handling changed error levels/handlers mostly 2020-09-11 00:36:56 +02:00
Jorge Sá Pereira e12895359b Set $errcontext argument optional to support PHP 8
- Argument is optional and deprecated in PHP 7.2
2020-09-06 22:37:38 +01:00
17 changed files with 22 additions and 57 deletions
+1
View File
@@ -12,6 +12,7 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/error_reporting.ini export-ignore
/make-release.sh export-ignore
/phpunit.sh export-ignore
/phpunit.xml export-ignore
-11
View File
@@ -6,16 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Security
- Code injection vulnerability by using illegal function names in `{function name='blah'}{/function}`
## [3.1.38] - 2021-01-08
### Fixed
- Smarty::SMARTY_VERSION wasn't updated https://github.com/smarty-php/smarty/issues/628
## [3.1.37] - 2021-01-07
### Changed
- Changed error handlers and handling of undefined constants for php8-compatibility (set $errcontext argument optional) https://github.com/smarty-php/smarty/issues/605
- Changed expected error levels in unit tests for php8-compatibility
@@ -24,7 +14,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- PHP5.3 compatibility fixes
- Brought lexer source functionally up-to-date with compiled version
## [3.1.36] - 2020-04-14
+1 -1
View File
@@ -3,7 +3,7 @@ Smarty: the PHP compiling template engine
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
+1
View File
@@ -0,0 +1 @@
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
+2 -8
View File
@@ -249,13 +249,7 @@ template ::= template PHP(B). {
// template text
template ::= template TEXT(B). {
$text = $this->yystack[ $this->yyidx + 0 ]->minor;
if ((string)$text == '') {
$this->current_buffer->append_subtree($this, null);
}
$this->current_buffer->append_subtree($this, new Smarty_Internal_ParseTree_Text($text, $this->strip));
$this->current_buffer->append_subtree($this, $this->compiler->processText(B));
}
// strip on
template ::= template STRIPON. {
@@ -314,7 +308,7 @@ smartytag(A)::= SIMPLETAG(B). {
$tag = trim(substr(B, $this->compiler->getLdelLength(), -$this->compiler->getRdelLength()));
if ($tag == 'strip') {
$this->strip = true;
A = null;
A = null;;
} else {
if (defined($tag)) {
if ($this->security) {
+3 -2
View File
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,6 +27,7 @@
* @author Uwe Tews <uwe dot tews at gmail dot com>
* @author Rodney Rehm
* @package Smarty
* @version 3.1.34-dev
*/
/**
* set SMARTY_DIR to absolute path to Smarty library files.
@@ -111,7 +112,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.38';
const SMARTY_VERSION = '3.1.36';
/**
* define variable scopes
*/
+1 -1
View File
@@ -6,7 +6,7 @@
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -58,11 +58,6 @@ class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
}
unset($_attr[ 'nocache' ]);
$_name = trim($_attr[ 'name' ], '\'"');
if (!preg_match('/^[a-zA-Z0-9_\x80-\xff]+$/', $_name)) {
$compiler->trigger_template_error("Function name contains invalid characters: {$_name}", null, true);
}
$compiler->parent_compiler->tpl_function[ $_name ] = array();
$save = array(
$_attr, $compiler->parser->current_buffer, $compiler->template->compiled->has_nocache_code,
@@ -94,9 +94,9 @@ class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_C
break;
}
if (strpos($_index[ 1 ], '$') === false && strpos($_index[ 1 ], '\'') === false) {
return "(defined('{$_index[1]}') ? constant('{$_index[1]}') : null)";
return "defined('{$_index[1]}') ? constant('{$_index[1]}') : null";
} else {
return "(defined({$_index[1]}) ? constant({$_index[1]}) : null)";
return "defined({$_index[1]}) ? constant({$_index[1]}) : null";
}
// no break
case 'config':
@@ -115,7 +115,7 @@ class Smarty_Internal_Config_File_Compiler
$this->smarty->_debug->start_compile($this->template);
}
// init the lexer/parser to compile the config file
/* @var Smarty_Internal_ConfigFileLexer $this->lex */
/* @var Smarty_Internal_ConfigFileLexer $this ->lex */
$this->lex = new $this->lexer_class(
str_replace(
array(
@@ -127,7 +127,7 @@ class Smarty_Internal_Config_File_Compiler
) . "\n",
$this
);
/* @var Smarty_Internal_ConfigFileParser $this->parser */
/* @var Smarty_Internal_ConfigFileParser $this ->parser */
$this->parser = new $this->parser_class($this->lex, $this);
if (function_exists('mb_internal_encoding')
&& function_exists('ini_get')
@@ -339,10 +339,6 @@ class CacheResourceTestCommon extends PHPUnit_Smarty
$this->assertNull($tpl->cached->handler->getCachedContent($tpl3));
$this->assertEquals('hello world', $tpl->cached->handler->getCachedContent($tpl4));
}
/**
* @group slow
*/
public function testClearCacheExpired()
{
$this->smarty->caching = true;
@@ -403,7 +399,7 @@ class CacheResourceTestCommon extends PHPUnit_Smarty
* @runInSeparateProcess
* @preserveGlobalState disabled
* @dataProvider data
* @group slow
*
*/
public function testCache($lockTime, $lockTimeout, $compile_id, $cache_id, $isCached, $tmin, $tmax, $forceCompile, $forceCache, $update, $testNumber, $compileTestNumber, $renderTestNumber, $testName)
{
@@ -125,7 +125,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
* test grandchild/child/parent dependency test2
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*
*/
public function testCompileBlockGrandChildMustCompile_021_2()
{
@@ -193,7 +193,7 @@ class ExtendsResourceTest extends PHPUnit_Smarty
* test grandchild/child/parent dependency test4
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*
*/
public function testCompileBlockGrandChildMustCompile_021_4()
{
@@ -610,7 +610,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*
*/
public function testCompileBlockGrandChildMustCompile_021_2()
{
@@ -645,7 +645,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*
*/
public function testCompileBlockGrandChildMustCompile_021_3()
{
@@ -670,7 +670,7 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*
*/
public function testCompileBlockGrandChildMustCompile_021_32()
{
@@ -692,7 +692,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_4()
{
@@ -717,7 +716,6 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*/
public function testCompileBlockGrandChildMustCompile_021_42()
{
@@ -210,7 +210,6 @@ class CompileInsertTest extends PHPUnit_Smarty
* test insert plugin caching 2
* @runInSeparateProcess
* @preserveGlobalState disabled
* @group slow
*/
public function testInsertPluginCaching3_2()
{
@@ -431,14 +431,5 @@ class CompileFunctionTest extends PHPUnit_Smarty
array("{function name=simple}A{\$foo}\nC{/function}{call name='simple'}", "Abar\nC", 'T14', $i++),
array("{function name=simple}A\n{\$foo}\nC{/function}{call name='simple'}", "A\nbar\nC", 'T15', $i++),
);
}
/**
* Test handling of function names that are a security risk
* @expectedException SmartyCompilerException
*/
public function testIllegalFunctionName() {
$this->smarty->fetch('string:{function name=\'rce(){};echo "hi";function \'}{/function}');
}
}
}
@@ -35,7 +35,7 @@ class SmartyNowTest extends PHPUnit_Smarty
}
/**
* test {$smarty.now nocache}
* @group slow
*
*/
public function testSmartyNowNocache() {
$this->smarty->setCaching(true);
@@ -59,7 +59,7 @@ class StreamVariableTest extends PHPUnit_Smarty
}
*/
/**
* test no existent stream variable
* test no existant stream variable
*/
// public function testStreamVariable2()
// {