Compare commits

...

14 Commits

Author SHA1 Message Date
Simon Wisselink c7a64ce0b3 Merge branch 'master' into issue_906 2023-11-06 17:25:20 +01:00
Simon Wisselink 66ba7cfb95 Fix double changelog merged entry 2023-11-06 15:52:52 +01:00
Simon Wisselink 20764ff963 Add changelog 2023-11-06 15:51:45 +01:00
Simon Wisselink d5c7f8c5f5 Add support for MacOS test running using mutagen-compose. 2023-11-06 15:51:45 +01:00
Shad ffb9f9eb26 Typos in documentation (#914) 2023-11-06 15:51:45 +01:00
Simon Wisselink a65c652778 changelog 2023-11-06 15:51:37 +01:00
Simon Wisselink 0dd786ea8f Added some extra unit test 2023-11-06 15:51:19 +01:00
Simon Wisselink ae5ca4e4c4 add case sensitivity test 2023-11-06 15:51:19 +01:00
Jack Dane 46f96877b1 Fix case-sensitive tag names (#907) (#910)
* Don't lower tags until they are used for extensions so custom tags can be case-sensitive.
2023-11-06 15:51:19 +01:00
Simon Wisselink 50dd6856c5 Add changelog 2023-11-06 15:48:14 +01:00
Simon Wisselink b28b85dbf4 Add support for MacOS test running using mutagen-compose. 2023-11-06 13:22:07 +01:00
Shad ad73f4943b Typos in documentation (#914) 2023-10-28 16:41:10 +02:00
Simon Wisselink 4d22803c32 changelog 2023-10-22 23:56:37 +02:00
Simon Wisselink 134e7074ce Do not auto-html-escape custom function results.
Fixes #906
This behavior is under-defined though. This requires some clear documentation.
2023-09-21 23:52:45 +02:00
7 changed files with 80 additions and 13 deletions
+2
View File
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Registered output filters wouldn't run [#899](https://github.com/smarty-php/smarty/issues/899)
- Use of negative numbers in {math} equations [#895](https://github.com/smarty-php/smarty/issues/895)
- Do not auto-html-escape custom function results [#906](https://github.com/smarty-php/smarty/issues/906)
- Fix case-sensitive tag names [#907](https://github.com/smarty-php/smarty/issues/907)
### Removed
- Removed `$smarty->registered_filters` array
+33 -1
View File
@@ -5,7 +5,7 @@ services:
context: .
dockerfile: ./utilities/testrunners/php72/Dockerfile
volumes:
- .:/app
- smarty-code:/app
working_dir: /app
php72:
extends:
@@ -37,3 +37,35 @@ services:
service: base
build:
dockerfile: ./utilities/testrunners/php82/Dockerfile
volumes:
smarty-code:
x-mutagen:
sync:
defaults:
symlink:
mode: "posix-raw"
ignore:
vcs: true
paths:
- ".docker"
- ".env.docker"
- ".bundles"
- "docker-compose.yml"
- ".idea"
- ".DS_Store"
mode: "two-way-resolved"
configurationBeta:
permissions:
defaultOwner: "id:${APP_USER_ID}"
defaultGroup: "id:${APP_GROUP_ID}"
defaultFileMode: 0666
defaultDirectoryMode: 0755
permissions:
defaultOwner: "id:${APP_USER_ID}"
defaultGroup: "id:${APP_GROUP_ID}"
smarty-code:
alpha: "."
beta: "volume://smarty-code"
@@ -85,11 +85,11 @@ The template above includes the example `links.tpl` below
```smarty
<div id="box">
<h3>{$title}{/h3>
<h3>{$title}</h3>
<ul>
{foreach from=$links item=l}
.. do stuff ...
</foreach}
{/foreach}
</ul>
</div>
```
@@ -326,10 +326,10 @@ The template to output the database result in a HTML table
```smarty
<table>
<tr><th>&nbsp;</th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
<tr><th>&nbsp;</th><th>Name</th><th>Home</th><th>Cell</th><th>Email</th></tr>
{section name=co loop=$contacts}
<tr>
<td><a href="view.php?id={$contacts[co].id}">view<a></td>
<td><a href="view.php?id={$contacts[co].id}">view</a></td>
<td>{$contacts[co].name}</td>
<td>{$contacts[co].home}</td>
<td>{$contacts[co].cell}</td>
@@ -465,7 +465,7 @@ header block every five rows.
<table>
{section name=co loop=$contacts}
{if $smarty.section.co.iteration is div by 5}
<tr><th>&nbsp;</th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
<tr><th>&nbsp;</th><th>Name</th><th>Home</th><th>Cell</th><th>Email</th></tr>
{/if}
<tr>
<td><a href="view.php?id={$contacts[co].id}">view<a></td>
+8 -6
View File
@@ -5,9 +5,11 @@
# - ./run-tests-for-all-php-versions.sh --group 20221124
# - ./run-tests-for-all-php-versions.sh --exclude-group slow
docker-compose run php72 ./run-tests.sh $@ && \
docker-compose run php73 ./run-tests.sh $@ && \
docker-compose run php74 ./run-tests.sh $@ && \
docker-compose run php80 ./run-tests.sh $@ && \
docker-compose run php81 ./run-tests.sh $@ && \
docker-compose run php82 ./run-tests.sh $@
COMPOSE_CMD="mutagen-compose"
$COMPOSE_CMD run --rm php72 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php74 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php74 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php80 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php81 ./run-tests.sh $@ && \
$COMPOSE_CMD run --rm php82 ./run-tests.sh $@
+1 -1
View File
@@ -1143,7 +1143,7 @@ class Template extends BaseCompiler {
if ($this->smarty->getFunctionHandler($base_tag)) {
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($base_tag, $this)) {
return (new \Smarty\Compile\PrintExpressionCompiler())->compile(
[],
['nofilter'], // functions are never auto-escaped
$this,
['value' => $this->compileFunctionCall($base_tag, $args, $parameter)]
);
@@ -30,4 +30,35 @@ class AutoEscapeTest extends PHPUnit_Smarty
$tpl->assign('foo', '<a@b.c>');
$this->assertEquals("&lt;a@b.c&gt;", $this->smarty->fetch($tpl));
}
/**
* test 'escapeHtml' property
* @group issue906
*/
public function testAutoEscapeDoesNotEscapeFunctionPlugins()
{
$this->smarty->registerPlugin(
\Smarty\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\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));
}
}