mirror of
https://github.com/smarty-php/smarty.git
synced 2026-08-09 23:11:30 +02:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1150fc5ecd | ||
|
|
6e067ed327 | ||
|
|
3931d8f54b | ||
|
|
d8c1dfe56e | ||
|
|
6887e55ded | ||
|
|
642fd69fea | ||
|
|
17a7d6fb5b | ||
|
|
b96a5c3953 | ||
|
|
2ff66e0fcc | ||
|
|
d6c4274822 |
@@ -32,6 +32,7 @@ jobs:
|
|||||||
- "8.0"
|
- "8.0"
|
||||||
- "8.1"
|
- "8.1"
|
||||||
- "8.2"
|
- "8.2"
|
||||||
|
- "8.3"
|
||||||
|
|
||||||
compiler:
|
compiler:
|
||||||
- default
|
- default
|
||||||
@@ -46,7 +47,9 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
php-version: "8.2"
|
php-version: "8.2"
|
||||||
compiler: jit
|
compiler: jit
|
||||||
|
- os: ubuntu-latest
|
||||||
|
php-version: "8.3"
|
||||||
|
compiler: jit
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -6,8 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- PHP8.3 support [#925](https://github.com/smarty-php/smarty/issues/925)
|
||||||
|
|
||||||
|
## [4.3.4] - 2023-09-14
|
||||||
|
|
||||||
|
## [4.3.3] - 2023-09-14
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- `|strip_tags` does not work if the input is 0 [#890](https://github.com/smarty-php/smarty/issues/890)
|
- `|strip_tags` does not work if the input is 0 [#890](https://github.com/smarty-php/smarty/issues/890)
|
||||||
|
- Use of negative numbers in {math} equations [#895](https://github.com/smarty-php/smarty/issues/895)
|
||||||
|
|
||||||
## [4.3.2] - 2023-07-19
|
## [4.3.2] - 2023-07-19
|
||||||
|
|
||||||
|
|||||||
@@ -42,3 +42,8 @@ services:
|
|||||||
service: base
|
service: base
|
||||||
build:
|
build:
|
||||||
dockerfile: ./utilities/testrunners/php82/Dockerfile
|
dockerfile: ./utilities/testrunners/php82/Dockerfile
|
||||||
|
php83:
|
||||||
|
extends:
|
||||||
|
service: base
|
||||||
|
build:
|
||||||
|
dockerfile: ./utilities/testrunners/php83/Dockerfile
|
||||||
@@ -107,7 +107,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '4.3.2';
|
const SMARTY_VERSION = '4.3.4';
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ function smarty_function_math($params, $template)
|
|||||||
$equation = preg_replace('/\s+/', '', $equation);
|
$equation = preg_replace('/\s+/', '', $equation);
|
||||||
|
|
||||||
// Adapted from https://www.php.net/manual/en/function.eval.php#107377
|
// Adapted from https://www.php.net/manual/en/function.eval.php#107377
|
||||||
$number = '(?:\d+(?:[,.]\d+)?|pi|π)'; // What is a number
|
$number = '-?(?:\d+(?:[,.]\d+)?|pi|π)'; // What is a number
|
||||||
$functionsOrVars = '((?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))';
|
$functionsOrVars = '((?:0x[a-fA-F0-9]+)|([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*))';
|
||||||
$operators = '[,+\/*\^%-]'; // Allowed math operators
|
$operators = '[,+\/*\^%-]'; // Allowed math operators
|
||||||
$regexp = '/^(('.$number.'|'.$functionsOrVars.'|('.$functionsOrVars.'\s*\((?1)*\)|\((?1)*\)))(?:'.$operators.'(?1))?)+$/';
|
$regexp = '/^(('.$number.'|'.$functionsOrVars.'|('.$functionsOrVars.'\s*\((?1)*\)|\((?1)*\)))(?:'.$operators.'(?1))?)+$/';
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class Smarty_Internal_ErrorHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($this->allowUndefinedArrayKeys && preg_match(
|
if ($this->allowUndefinedArrayKeys && preg_match(
|
||||||
'/^(Undefined index|Undefined array key|Trying to access array offset on value of type)/',
|
'/^(Undefined index|Undefined array key|Trying to access array offset on)/',
|
||||||
$errstr
|
$errstr
|
||||||
)) {
|
)) {
|
||||||
return; // suppresses this error
|
return; // suppresses this error
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
*
|
*
|
||||||
* @param Smarty_Internal_Template $_template
|
* @param Smarty_Internal_Template $_template
|
||||||
*
|
*
|
||||||
* @return string
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function render(Smarty_Internal_Template $_template)
|
public function render(Smarty_Internal_Template $_template)
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ sed -i "s/const SMARTY_VERSION = '[^']\+';/const SMARTY_VERSION = '$1';/" libs/S
|
|||||||
git add CHANGELOG.md libs/Smarty.class.php
|
git add CHANGELOG.md libs/Smarty.class.php
|
||||||
git commit -m "version bump"
|
git commit -m "version bump"
|
||||||
|
|
||||||
git checkout master
|
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"
|
||||||
|
|||||||
@@ -10,4 +10,6 @@ docker-compose run php72 ./run-tests.sh $@ && \
|
|||||||
docker-compose run php73 ./run-tests.sh $@ && \
|
docker-compose run php73 ./run-tests.sh $@ && \
|
||||||
docker-compose run php74 ./run-tests.sh $@ && \
|
docker-compose run php74 ./run-tests.sh $@ && \
|
||||||
docker-compose run php80 ./run-tests.sh $@ && \
|
docker-compose run php80 ./run-tests.sh $@ && \
|
||||||
docker-compose run php81 ./run-tests.sh $@
|
docker-compose run php81 ./run-tests.sh $@ && \
|
||||||
|
docker-compose run php82 ./run-tests.sh $@ && \
|
||||||
|
docker-compose run php83 ./run-tests.sh $@
|
||||||
|
|||||||
@@ -30,4 +30,36 @@ class AutoEscapeTest extends PHPUnit_Smarty
|
|||||||
$tpl->assign('foo', '<a@b.c>');
|
$tpl->assign('foo', '<a@b.c>');
|
||||||
$this->assertEquals("<a@b.c>", $this->smarty->fetch($tpl));
|
$this->assertEquals("<a@b.c>", $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test 'escapeHtml' property
|
||||||
|
* @group issue906
|
||||||
|
*/
|
||||||
|
public function testAutoEscapeDoesNotEscapeFunctionPlugins()
|
||||||
|
{
|
||||||
|
$this->smarty->registerPlugin(
|
||||||
|
Smarty::PLUGIN_FUNCTION,
|
||||||
|
'horizontal_rule',
|
||||||
|
function ($params, $smarty) { return "<hr>"; }
|
||||||
|
);
|
||||||
|
$tpl = $this->smarty->createTemplate('eval:{horizontal_rule}');
|
||||||
|
$this->assertEquals("<hr>", $this->smarty->fetch($tpl));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test 'escapeHtml' property
|
||||||
|
* @group issue906
|
||||||
|
*/
|
||||||
|
public function testAutoEscapeDoesNotEscapeBlockPlugins()
|
||||||
|
{
|
||||||
|
$this->smarty->registerPlugin(
|
||||||
|
Smarty::PLUGIN_BLOCK,
|
||||||
|
'paragraphify',
|
||||||
|
function ($params, $content) { return $content == null ? null : "<p>".$content."</p>"; }
|
||||||
|
);
|
||||||
|
$tpl = $this->smarty->createTemplate('eval:{paragraphify}hi{/paragraphify}');
|
||||||
|
$this->assertEquals("<p>hi</p>", $this->smarty->fetch($tpl));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -101,6 +101,14 @@ class MathTest extends PHPUnit_Smarty
|
|||||||
$this->assertEquals($expected, $this->smarty->fetch($tpl));
|
$this->assertEquals($expected, $this->smarty->fetch($tpl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNegativeNumbers()
|
||||||
|
{
|
||||||
|
$this->smarty->disableSecurity();
|
||||||
|
$expected = "-19 -- 4.1";
|
||||||
|
$tpl = $this->smarty->createTemplate('eval:{$x = 4}{$y = 5.5}{math equation="-2.0*(x+y)" x=$x y=$y} -- {math equation="-20.5 / -5"}');
|
||||||
|
$this->assertEquals($expected, $this->smarty->fetch($tpl));
|
||||||
|
}
|
||||||
|
|
||||||
public function testSyntaxFormat()
|
public function testSyntaxFormat()
|
||||||
{
|
{
|
||||||
$this->smarty->disableSecurity();
|
$this->smarty->disableSecurity();
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
FROM php:8.3-cli
|
||||||
|
|
||||||
|
## Basic utilities
|
||||||
|
RUN apt-get update -yqq && apt-get install -y curl apt-utils git zip unzip
|
||||||
|
|
||||||
|
## Composer
|
||||||
|
COPY ./utilities/testrunners/shared/install-composer.sh /root/install-composer.sh
|
||||||
|
WORKDIR /root
|
||||||
|
RUN sh ./install-composer.sh
|
||||||
|
RUN mv ./composer.phar /usr/local/bin/composer
|
||||||
Reference in New Issue
Block a user