Compare commits

...

31 Commits

Author SHA1 Message Date
Simon Wisselink 73da7e90f3 Merge branch 'release/5.7.0' 2025-11-19 22:36:38 +01:00
Simon Wisselink c0d7a36124 version bump 2025-11-19 22:36:36 +01:00
Simon Wisselink 8cc9a75964 Php8.5 support (#1138)
* PHP 8.5 support (using RC docker image for php 8.5 unit tests)
2025-11-19 22:33:49 +01:00
Wim Wisselink 21d7fbb67e Non-canonical cast (boolean) fix (#1145) 2025-10-17 14:45:38 +02:00
Simon Wisselink 1fc41e385d Merge branch 'release/5.6.0' 2025-10-03 23:22:25 +02:00
Simon Wisselink fe325daec0 version bump 2025-10-03 23:22:23 +02:00
Simon Wisselink 3f0f308a7b added changelog 2025-10-03 23:19:22 +02:00
pharixces b390e50974 Add support for shorttags in functions (#1142)
* Add support for shorttags in functions

Co-authored-by: Anne Zijlstra <a.zijlstra@iwink.nl>
Co-authored-by: Simon Wisselink <s.wisselink@iwink.nl>
2025-10-03 23:17:55 +02:00
Simon Wisselink 0e46ae3add Merge branch 'release/5.5.2' 2025-08-26 10:38:06 +02:00
Simon Wisselink 4d793ee04c version bump 2025-08-26 10:38:05 +02:00
Simon Wisselink 7677b84058 Fixed escaping of array/object keys in debug_print_var 2025-08-26 10:32:02 +02:00
Simon Wisselink e7457d78cb Add iWink and Temma logos 2025-05-27 22:39:34 +02:00
Simon Wisselink cbcd66e1de Merge branch 'release/5.5.1' 2025-05-19 11:29:42 +02:00
Simon Wisselink 46cd224efb version bump 2025-05-19 11:29:40 +02:00
Simon Wisselink d3b716a0b9 changelog 2025-05-19 11:29:30 +02:00
pharixces 693502c341 Bugfix/bcpluginsadapter support modifiercompiler (#1132)
* Add support for modifiercompiler in the BCPluginsAdapter class.

---------

Co-authored-by: Anne Zijlstra <a.zijlstra@iwink.nl>
2025-05-19 11:28:10 +02:00
Shad bb968469fa add empty and in_array modifier doc (#1113) 2025-05-06 14:23:46 +02:00
Simon Wisselink 372f7cf41a Merge branch 'release/5.5.0' 2025-05-03 23:36:46 +02:00
Simon Wisselink f659193c94 version bump 2025-05-03 23:36:44 +02:00
Simon Wisselink 0b6166482a changelog 2025-05-03 23:36:27 +02:00
hirosan 4ff25bbe59 Support trailing comma in array (#1128) 2025-05-03 23:34:15 +02:00
hirosan afbd71b868 Update getting-started.md (#1111)
Indicate support for php8.4 in docs.
2025-04-16 08:11:00 +02:00
Simon Wisselink e26f82d02c Merge branch 'release/5.4.5' 2025-04-15 13:20:08 +02:00
Simon Wisselink 6ad6a35824 version bump 2025-04-15 13:20:06 +02:00
Simon Wisselink baa53399f5 changelog 2025-04-15 13:19:54 +02:00
gherosh 37bea77ea7 Update StringEval.php (#1126)
Fix: Implicitly marking parameter $_template as nullable is deprecated, the explicit nullable type must be used instead
2025-04-15 13:19:00 +02:00
Simon Wisselink 0d33f3acde Added sponsor 2025-04-13 22:34:16 +02:00
Simon Wisselink 05adbf45f3 Drop jit runs from CI unit tests.
Fixes #1125
2025-04-13 22:20:14 +02:00
Simon Wisselink df4795b803 Merge branch 'release/5.4.4' 2025-04-13 22:12:10 +02:00
Simon Wisselink 5401418258 version bump 2025-04-13 22:12:08 +02:00
Simon Wisselink a5bbba3f05 Fix syntax error occurring when registering a function plugin that ends with the string 'close' (#1124)
Fixes #1122
2025-04-10 23:47:44 +02:00
29 changed files with 979 additions and 370 deletions
+1 -21
View File
@@ -34,35 +34,15 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
compiler:
- default
include:
- os: ubuntu-latest
php-version: "8.0"
compiler: jit
- os: ubuntu-latest
php-version: "8.1"
compiler: jit
- os: ubuntu-latest
php-version: "8.2"
compiler: jit
- os: ubuntu-latest
php-version: "8.3"
compiler: jit
- os: ubuntu-latest
php-version: "8.4"
compiler: jit
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Override PHP ini values for JIT compiler
if: matrix.compiler == 'jit'
run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
+30
View File
@@ -6,6 +6,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [5.7.0] - 2025-11-19
- PHP 8.5 support
## [5.6.0] - 2025-10-03
- Added support for shorttags in functions [#1005](https://github.com/smarty-php/smarty/issues/1005)
## [5.5.2] - 2025-08-26
- Fixed escaping of array/object keys in debug_print_var
## [5.5.1] - 2025-05-19
- Fix missing support for loading modifiercompilers from plugin dir in BCPluginsAdapter [#1132](https://github.com/smarty-php/smarty/pull/1132)
## [5.5.0] - 2025-05-03
- Support trailing comma in array [#1013](https://github.com/smarty-php/smarty/issues/1013)
## [5.4.5] - 2025-04-15
- Fixed deprecation notice in StringEval in PHP8.4 [#1119](https://github.com/smarty-php/smarty/issues/1119)
## [5.4.4] - 2025-04-13
- Fix syntax error occurring when registering a function plugin that ends with the string 'close' [#1122](https://github.com/smarty-php/smarty/issues/1122)
- Replace SMARTY_VERSION constant with $smarty.version in debug.tpl [#1073](https://github.com/smarty-php/smarty/issues/1073)
## [5.4.3] - 2024-12-23
- Fix PHP backtraces by qualifying/replacing `call_user_func_array` calls [#1074](https://github.com/smarty-php/smarty/issues/1074)
+9 -1
View File
@@ -7,7 +7,7 @@ Smarty is a template engine for PHP, facilitating the separation of presentation
Read the [documentation](https://smarty-php.github.io/smarty/) to find out how to use it.
## Requirements
Smarty v5 can be run with PHP 7.2 to PHP 8.4.
Smarty v5 can be run with PHP 7.2 to PHP 8.5.
## Installation
Smarty versions 3.1.11 or later can be installed with [Composer](https://getcomposer.org/).
@@ -18,3 +18,11 @@ composer require smarty/smarty
````
More in the [Getting Started](./docs/getting-started.md) section of the docs.
## Sponsors
Smarty is sponsored by:
- Marc Laporte [@marclaporte](https://github.com/marclaporte)
- [Temma](https://github.com/Digicreon/Temma), the MVC framework based on Smarty
Thank you!
-1
View File
@@ -1 +0,0 @@
- Replace SMARTY_VERSION constant with $smarty.version in debug.tpl [#1073](https://github.com/smarty-php/smarty/issues/1073)
@@ -0,0 +1,10 @@
# empty
Returns true if var does not exist or has a value that is empty or equal to zero, aka falsey, see conversion to boolean. Otherwise returns false.
## Basic usage
```smarty
{if $myVar|empty}it's an empty variable{/if}
{if empty($myVar)}it's an empty variable{/if}
```
@@ -0,0 +1,17 @@
# in_array
test if value is contained in an array
## Basic usage
```smarty
{if in_array('value2', $myarray)} value2 is in myarray{/if}
```
Can be replaced by operator *is in*
```smarty
{if 'value2' is in $myarray}value2 is in myarray{/if}
```
See Also [operators](../language-basic-syntax/language-syntax-operators.md)
+1 -1
View File
@@ -1,7 +1,7 @@
# Getting started
## Requirements
Smarty can be run with PHP 7.2 to PHP 8.3.
Smarty can be run with PHP 7.2 to PHP 8.5.
## Installation
Smarty can be installed with [Composer](https://getcomposer.org/).
+30
View File
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 343.3 174.5" style="enable-background:new 0 0 343.3 174.5;" xml:space="preserve">
<style type="text/css">
.st0{fill:#E60000;}
.st1{fill:#FFFFFF;}
</style>
<path class="st0" d="M333.8,0H9.5C4.3,0,0,4.3,0,9.5v155.4c0,5.3,4.3,9.5,9.5,9.5h324.3c5.3,0,9.5-4.3,9.5-9.5V9.5
C343.3,4.3,339,0,333.8,0z"/>
<g>
<path class="st1" d="M148.7,58.5c-5.2,0-4.7,4.3-4.7,9.5v38.6c0,5.3,4.3,9.5,9.5,9.5c5.2,0,9.5-4.3,9.5-9.5V81.5
C163,65.7,154,58.5,148.7,58.5L148.7,58.5z"/>
<path class="st1" d="M47.1,72.6c-5.2,0-4.7,4.3-4.7,9.5v24.5c0,5.2,4.3,9.5,9.5,9.5c5.2,0,9.5-4.3,9.5-9.5V95.5
C61.4,79.8,52.4,72.6,47.1,72.6L47.1,72.6z"/>
<path class="st1" d="M200.7,58.3c-7.4,0-13.8,6.9-15.2,11.4c-3-7.6-8.5-11.2-12.2-11.2c-5.2,0-4.7,4.3-4.7,9.5l0.1,9.5v29.1
c0,5.2,4.3,9.5,9.5,9.5c5.2,0,9.5-4.3,9.5-9.5V84.4c0-3.8,1.2-8.4,7-8.4c1.7,0,6.8,0,6.8,8.4v22.2c0,5.2,4.3,9.5,9.5,9.5
c5.2,0,9.5-4.3,9.5-9.5V79.8C220.5,66.5,212.9,58.3,200.7,58.3L200.7,58.3z"/>
<path class="st1" d="M130.8,58.4c-4.4,0-7.7,2.6-9.1,7.1l-6.1,19.9l-6.1-19.7c-1.4-4.6-5.1-7.4-9.6-7.4h-0.9
c-4.5,0-8.2,2.8-9.6,7.4l-5.4,17.5c-1.5-4.9-5.8-31.4-31.1-33c-8.7-0.5-11.2,4.7-12,7.6c-0.7,2.8-0.4,5.2,1.3,7.3
c1.7,2.2,5,2.5,8.9,4C61,73,63.6,81.8,65.9,87.3c0.8,1.9,6.4,20.8,6.4,20.8c1.8,5.2,5.4,8.1,10.2,8.1H83c4.8,0,8.4-2.9,10-7.8
l6.3-19.7l6.2,19.7c1.6,5,5.2,7.8,10,7.8h0.5c4.8,0,8.4-2.9,10.2-8L139.2,71l0-0.1c0.2-0.7,0.6-2.3,0.6-3.6
C139.8,62.3,135.9,58.4,130.8,58.4L130.8,58.4z"/>
<path class="st1" d="M276,99.9c-0.2-0.2-0.4-0.4-0.6-0.6l-14.1-14.4l11.3-9.6l0,0c1.9-1.8,4.1-4.3,4.1-8c0-4.3-3.2-8.7-8.6-8.7
c-3.6,0-5.9,1.9-8,3.9l-15,14.2c-1.6-12.5-9.2-18.4-14-18.4c-4.2,0-4.8,2.7-4.8,6.5c-0.1,1.1-0.1,2.4-0.1,3.7v38
c0,4.9,3.8,9.1,8.6,9.6c0.3,0,0.7,0.1,1,0.1c5.3,0,9.5-4.4,9.5-9.6v-7.5l3.3-3l14.5,16.4c0.6,0.6,1.3,1.3,2.1,1.9
c1.1,0.9,2.5,1.5,4.2,1.8c0.1,0,1.2,0.1,1.8,0.1c4.3-0.1,8.7-3.2,8.6-8.6C279.6,104.1,277.9,101.9,276,99.9L276,99.9z"/>
<circle class="st1" cx="293.3" cy="106.7" r="9.5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+68
View File
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="195mm"
height="43.093071mm"
viewBox="0 0 195 43.093071"
version="1.1"
id="svg1156"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1153" />
<g
id="layer1"
transform="translate(-6.9662436,-7.8467567)">
<g
id="g21305-1"
style="font-size:33.5139px;line-height:1.25;stroke-width:0.0700042"
transform="translate(1.0553387,0.93988827)">
<g
id="g21248-5">
<rect
style="font-size:33.5139px;line-height:1.25;fill:#107ef4;fill-opacity:1;stroke:none;stroke-width:0.0727743"
id="rect846-9-0-1-2-7-2-1-9"
width="43.093071"
height="43.093071"
x="5.9109049"
y="6.9068685"
ry="2.4179134" />
<path
d="M 22.234889,18.179756 V 36.734061 H 19.567887 V 18.179756 h -6.882585 v -2.35155 h 16.403494 v 2.35155 z"
style="font-size:31.75px;line-height:1.25;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill:#ffffff;stroke-width:0.238978"
id="path16874-7-9-2-4" />
<path
d="m 41.725989,35.328866 v 1.806679 q -0.946355,0.258097 -1.634613,0.258097 -2.380228,0 -2.46626,-2.380228 -1.691969,2.380228 -4.674422,2.380228 -1.548582,0 -2.580969,-0.745614 v 6.395069 H 27.989497 V 21.707084 h 2.380228 v 10.639329 q 0,1.347839 0.831645,2.150808 0.831646,0.802968 2.23684,0.802968 1.864034,0 2.982454,-1.376517 1.11842,-1.405195 1.11842,-3.699389 v -8.517199 h 2.380227 v 12.503362 q 0,1.175775 1.290485,1.175775 0.229419,0 0.516193,-0.05736 z"
style="font-size:31.75px;line-height:1.25;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill:#ffffff;stroke-width:0.238978"
id="path16871-6-1-9-9" />
</g>
<g
aria-label="Temma"
transform="matrix(0.91459055,0,0,0.9686482,-4.3308403,0.67015143)"
id="text87274-2-5-0"
style="font-size:39.8454px;line-height:1.25;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans';fill:#000000;stroke-width:0.0205099">
<path
d="m 89.719297,15.597759 v 4.50253 h -10.24872 v 23.30956 h -5.578356 v -23.30956 h -10.24872 v -4.50253 z"
style="font-weight:600;font-family:Poppins;-inkscape-font-specification:'Poppins Semi-Bold';fill:#000000"
id="path7781-61-0-9" />
<path
d="m 109.19647,31.894528 q 0,1.195362 -0.15939,2.151652 H 92.899673 q 0.199227,2.390724 1.673504,3.745467 1.4743,1.354744 3.62597,1.354744 3.107933,0 4.422823,-2.669642 h 6.01666 q -0.95629,3.187632 -3.66578,5.259593 -2.70948,2.032115 -6.654173,2.032115 -3.18765,0 -5.737768,-1.394588 -2.51026,-1.434435 -3.944694,-4.024386 -1.394589,-2.589951 -1.394589,-5.97681 0,-3.426705 1.394589,-6.016656 1.394589,-2.589951 3.904849,-3.98454 2.510273,-1.394589 5.777613,-1.394589 3.147783,0 5.618193,1.354743 2.51026,1.354744 3.86501,3.865004 1.39459,2.470415 1.39459,5.697893 z m -5.77759,-1.593816 q -0.0398,-2.151652 -1.55397,-3.426705 -1.51411,-1.314898 -3.705613,-1.314898 -2.07197,0 -3.50643,1.275053 -1.394586,1.235207 -1.713349,3.46655 z"
style="font-weight:600;font-family:Poppins;-inkscape-font-specification:'Poppins Semi-Bold';fill:#000000"
id="path7783-8-3-1" />
<path
d="m 140.67428,21.016733 q 4.06423,0 6.53465,2.51026 2.51026,2.470415 2.51026,6.9331 v 12.949756 h -5.57836 V 31.217156 q 0,-2.589951 -1.3149,-3.944695 -1.3149,-1.394589 -3.58608,-1.394589 -2.27119,0 -3.62594,1.394589 -1.31489,1.354744 -1.31489,3.944695 v 12.192693 h -5.57836 V 31.217156 q 0,-2.589951 -1.3149,-3.944695 -1.3149,-1.394589 -3.58608,-1.394589 -2.31104,0 -3.66578,1.394589 -1.3149,1.354744 -1.3149,3.944695 v 12.192693 h -5.57836 V 21.335496 h 5.57836 v 2.669642 q 1.07583,-1.394589 2.74933,-2.191497 1.71336,-0.796908 3.74547,-0.796908 2.58995,0 4.62207,1.115671 2.03211,1.075826 3.14778,3.107942 1.07583,-1.91258 3.10795,-3.068096 2.07196,-1.155517 4.46268,-1.155517 z"
style="font-weight:600;font-family:Poppins;-inkscape-font-specification:'Poppins Semi-Bold';fill:#000000"
id="path7785-7-6-7" />
<path
d="m 182.4322,21.016733 q 4.06423,0 6.53465,2.51026 2.51026,2.470415 2.51026,6.9331 v 12.949756 h -5.57836 V 31.217156 q 0,-2.589951 -1.31489,-3.944695 -1.3149,-1.394589 -3.58609,-1.394589 -2.27119,0 -3.62593,1.394589 -1.3149,1.354744 -1.3149,3.944695 v 12.192693 h -5.57836 V 31.217156 q 0,-2.589951 -1.31489,-3.944695 -1.3149,-1.394589 -3.58609,-1.394589 -2.31103,0 -3.66578,1.394589 -1.3149,1.354744 -1.3149,3.944695 v 12.192693 h -5.57835 V 21.335496 h 5.57835 v 2.669642 q 1.07583,-1.394589 2.74934,-2.191497 1.71335,-0.796908 3.74546,-0.796908 2.58996,0 4.62207,1.115671 2.03212,1.075826 3.14779,3.107942 1.07582,-1.91258 3.10794,-3.068096 2.07196,-1.155517 4.46268,-1.155517 z"
style="font-weight:600;font-family:Poppins;-inkscape-font-specification:'Poppins Semi-Bold';fill:#000000"
id="path7787-9-1-7" />
<path
d="m 195.34205,32.292982 q 0,-3.347014 1.3149,-5.936965 1.35474,-2.589951 3.62593,-3.98454 2.31104,-1.394589 5.14006,-1.394589 2.47041,0 4.3033,0.996135 1.87274,0.996135 2.98841,2.51026 v -3.147787 h 5.6182 v 22.074353 h -5.6182 v -3.227478 q -1.07583,1.553971 -2.98841,2.589952 -1.87273,0.996134 -4.34315,0.996134 -2.78917,0 -5.10021,-1.434434 -2.27119,-1.434434 -3.62593,-4.024385 -1.3149,-2.629797 -1.3149,-6.016656 z m 17.3726,0.07969 q 0,-2.032116 -0.79691,-3.46655 -0.79691,-1.47428 -2.15165,-2.231343 -1.35475,-0.796908 -2.90872,-0.796908 -1.55397,0 -2.86887,0.757063 -1.31489,0.757062 -2.15165,2.231342 -0.79691,1.434435 -0.79691,3.426705 0,1.99227 0.79691,3.506395 0.83676,1.47428 2.15165,2.271188 1.35475,0.796908 2.86887,0.796908 1.55397,0 2.90872,-0.757062 1.35474,-0.796908 2.15165,-2.231343 0.79691,-1.47428 0.79691,-3.506395 z"
style="font-weight:600;font-family:Poppins;-inkscape-font-specification:'Poppins Semi-Bold';fill:#000000"
id="path7789-2-0-1" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.0 KiB

+11 -1
View File
@@ -32,4 +32,14 @@ and 480 for $height, the result is:
- [Troubleshooting](./appendixes/troubleshooting.md)
## Source code
- [Smarty repository at GitHub](https://github.com/smarty-php/smarty)
- [Smarty repository at GitHub](https://github.com/smarty-php/smarty)
## Sponsors
### <img src="img/iwink-logo.svg" alt="iWink logo" width="100">
[iWink](https://www.iwink.nl/), fullservice digital agency
### <img src="img/temma-logo.svg" alt="Temma logo" width="100">
[Temma](https://www.temma.net/), the MVC framework based on Smarty
+2
View File
@@ -57,9 +57,11 @@ nav:
- 'date_format': 'designers/language-modifiers/language-modifier-date-format.md'
- 'debug_print_var': 'designers/language-modifiers/language-modifier-debug-print-var.md'
- 'default': 'designers/language-modifiers/language-modifier-default.md'
- 'empty': "designers/language-modifiers/language-modifier-empty.md"
- 'escape': 'designers/language-modifiers/language-modifier-escape.md'
- 'from_charset': 'designers/language-modifiers/language-modifier-from-charset.md'
- 'indent': 'designers/language-modifiers/language-modifier-indent.md'
- 'in_array': 'designers/language-modifiers/language-modifier-in_array.md'
- 'is_array': 'designers/language-modifiers/language-modifier-is_array.md'
- 'isset': 'designers/language-modifiers/language-modifier-isset.md'
- 'join': 'designers/language-modifiers/language-modifier-join.md'
+144
View File
@@ -0,0 +1,144 @@
<?php
namespace Smarty\Compile;
/**
* This class handles compiling the attributes.
*/
class AttributeCompiler
{
/**
* Array of names of required attributes required by tag
*
* @var array
*/
protected $required_attributes = [];
/**
* Array of names of optional attribute required by tag
* use array('_any') if there is no restriction of attributes names
*
* @var array
*/
protected $optional_attributes = [];
/**
* Shorttag attribute order defined by its names
*
* @var array
*/
protected $shorttag_order = [];
/**
* Array of names of valid option flags
*
* @var array
*/
protected $option_flags = [];
public function __construct(
array $required_attributes = [],
array $optional_attributes = [],
array $shorttag_order = [],
array $option_flags = []
) {
$this->required_attributes = $required_attributes;
$this->optional_attributes = $optional_attributes;
$this->shorttag_order = $shorttag_order;
$this->option_flags = $option_flags;
}
/**
* This function checks if the attributes passed are valid
* The attributes passed for the tag to compile are checked against the list of required and
* optional attributes. Required attributes must be present. Optional attributes are check against
* the corresponding list. The keyword '_any' specifies that any attribute will be accepted
* as valid
*
* @param object $compiler compiler object
* @param array $attributes attributes applied to the tag
*
* @return array of mapped attributes for further processing
*/
public function getAttributes($compiler, $attributes)
{
$_indexed_attr = [];
$options = array_fill_keys($this->option_flags, true);
foreach ($attributes as $key => $mixed) {
// shorthand ?
if (!is_array($mixed)) {
// options flag ?
if (isset($options[trim($mixed, '\'"')])) {
$_indexed_attr[trim($mixed, '\'"')] = true;
// shorthand attribute ?
} elseif (isset($this->shorttag_order[$key])) {
$_indexed_attr[$this->shorttag_order[$key]] = $mixed;
} else {
// too many shorthands
$compiler->trigger_template_error('too many shorthand attributes', null, true);
}
// named attribute
} else {
foreach ($mixed as $k => $v) {
// options flag?
if (isset($options[$k])) {
if (is_bool($v)) {
$_indexed_attr[$k] = $v;
} else {
if (is_string($v)) {
$v = trim($v, '\'" ');
}
// Mapping array for boolean option value
static $optionMap = [1 => true, 0 => false, 'true' => true, 'false' => false];
if (isset($optionMap[$v])) {
$_indexed_attr[$k] = $optionMap[$v];
} else {
$compiler->trigger_template_error(
"illegal value '" . var_export($v, true) .
"' for options flag '{$k}'",
null,
true
);
}
}
// must be named attribute
} else {
$_indexed_attr[$k] = $v;
}
}
}
}
// check if all required attributes present
foreach ($this->required_attributes as $attr) {
if (!isset($_indexed_attr[$attr])) {
$compiler->trigger_template_error("missing '{$attr}' attribute", null, true);
}
}
// check for not allowed attributes
if ($this->optional_attributes !== ['_any']) {
$allowedAttributes = array_fill_keys(
array_merge(
$this->required_attributes,
$this->optional_attributes,
$this->option_flags
),
true
);
foreach ($_indexed_attr as $key => $dummy) {
if (!isset($allowedAttributes[$key]) && $key !== 0) {
$compiler->trigger_template_error("unexpected '{$key}' attribute", null, true);
}
}
}
// default 'false' for all options flags not set
foreach ($this->option_flags as $flag) {
if (!isset($_indexed_attr[$flag])) {
$_indexed_attr[$flag] = false;
}
}
return $_indexed_attr;
}
}
+6 -78
View File
@@ -82,84 +82,12 @@ abstract class Base implements CompilerInterface {
* @return array of mapped attributes for further processing
*/
protected function getAttributes($compiler, $attributes) {
$_indexed_attr = [];
$options = array_fill_keys($this->option_flags, true);
foreach ($attributes as $key => $mixed) {
// shorthand ?
if (!is_array($mixed)) {
// options flag ?
if (isset($options[trim($mixed, '\'"')])) {
$_indexed_attr[trim($mixed, '\'"')] = true;
// shorthand attribute ?
} elseif (isset($this->shorttag_order[$key])) {
$_indexed_attr[$this->shorttag_order[$key]] = $mixed;
} else {
// too many shorthands
$compiler->trigger_template_error('too many shorthand attributes', null, true);
}
// named attribute
} else {
foreach ($mixed as $k => $v) {
// options flag?
if (isset($options[$k])) {
if (is_bool($v)) {
$_indexed_attr[$k] = $v;
} else {
if (is_string($v)) {
$v = trim($v, '\'" ');
}
// Mapping array for boolean option value
static $optionMap = [1 => true, 0 => false, 'true' => true, 'false' => false];
if (isset($optionMap[$v])) {
$_indexed_attr[$k] = $optionMap[$v];
} else {
$compiler->trigger_template_error(
"illegal value '" . var_export($v, true) .
"' for options flag '{$k}'",
null,
true
);
}
}
// must be named attribute
} else {
$_indexed_attr[$k] = $v;
}
}
}
}
// check if all required attributes present
foreach ($this->required_attributes as $attr) {
if (!isset($_indexed_attr[$attr])) {
$compiler->trigger_template_error("missing '{$attr}' attribute", null, true);
}
}
// check for not allowed attributes
if ($this->optional_attributes !== ['_any']) {
$allowedAttributes = array_fill_keys(
array_merge(
$this->required_attributes,
$this->optional_attributes,
$this->option_flags
),
true
);
foreach ($_indexed_attr as $key => $dummy) {
if (!isset($allowedAttributes[$key]) && $key !== 0) {
$compiler->trigger_template_error("unexpected '{$key}' attribute", null, true);
}
}
}
// default 'false' for all options flags not set
foreach ($this->option_flags as $flag) {
if (!isset($_indexed_attr[$flag])) {
$_indexed_attr[$flag] = false;
}
}
return $_indexed_attr;
return (new AttributeCompiler(
$this->required_attributes,
$this->optional_attributes,
$this->shorttag_order,
$this->option_flags
))->getAttributes($compiler, $attributes);
}
/**
+20 -16
View File
@@ -3,24 +3,18 @@
* Smarty Internal Plugin Compile Registered Function
* Compiles code for the execution of a registered function
*
* @author Uwe Tews
*/
namespace Smarty\Compile;
use Smarty\Compiler\Template;
use Smarty\CompilerException;
use Smarty\FunctionHandler\AttributeFunctionHandlerInterface;
/**
* Smarty Internal Plugin Compile Registered Function Class
*
*/
class FunctionCallCompiler extends Base {
/**
* Attribute definition: Overwrites base class.
*
@@ -51,17 +45,27 @@ class FunctionCallCompiler extends Base {
*/
public function compile($args, Template $compiler, $parameter = [], $tag = null, $function = null): string
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
unset($_attr['nocache']);
$_paramsArray = $this->formatParamsArray($_attr);
$_params = 'array(' . implode(',', $_paramsArray) . ')';
if ($functionHandler = $compiler->getSmarty()->getFunctionHandler($function)) {
$attribute_overrides = [];
if ($functionHandler instanceof AttributeFunctionHandlerInterface) {
$attribute_overrides = $functionHandler->getSupportedAttributes();
}
// check and get attributes
$_attr = (new AttributeCompiler(
$attribute_overrides['required_attributes'] ?? $this->required_attributes,
$attribute_overrides['optional_attributes'] ?? $this->optional_attributes,
$attribute_overrides['shorttag_order'] ?? $this->shorttag_order,
$attribute_overrides['option_flags'] ?? $this->option_flags
))->getAttributes($compiler, $args);
unset($_attr['nocache']);
$_paramsArray = $this->formatParamsArray($_attr);
$_params = 'array(' . implode(',', $_paramsArray) . ')';
// not cacheable?
$compiler->tag_nocache = $compiler->tag_nocache || !$functionHandler->isCacheable();
$output = "\$_smarty_tpl->getSmarty()->getFunctionHandler(" . var_export($function, true) . ")";
+6 -6
View File
@@ -1146,12 +1146,12 @@ class Template extends BaseCompiler {
}
// check if tag is a function
if ($this->smarty->getFunctionHandler($base_tag)) {
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($base_tag, $this)) {
if ($this->smarty->getFunctionHandler($tag)) {
if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
return (new \Smarty\Compile\PrintExpressionCompiler())->compile(
['nofilter'], // functions are never auto-escaped
$this,
['value' => $this->compileFunctionCall($base_tag, $args, $parameter)]
['value' => $this->compileFunctionCall($tag, $args, $parameter)]
);
}
}
@@ -1164,16 +1164,16 @@ class Template extends BaseCompiler {
}
// the default plugin handler is a handler of last resort, it may also handle not specifically registered tags.
if ($callback = $this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_COMPILER)) {
if ($callback = $this->getPluginFromDefaultHandler($tag, Smarty::PLUGIN_COMPILER)) {
if (!empty($parameter['modifierlist'])) {
throw new CompilerException('No modifiers allowed on ' . $base_tag);
throw new CompilerException('No modifiers allowed on ' . $tag);
}
$tagCompiler = new \Smarty\Compile\Tag\BCPluginWrapper($callback);
return $tagCompiler->compile($args, $this, $parameter);
}
if ($this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_FUNCTION)) {
return $this->defaultHandlerFunctionCallCompiler->compile($args, $this, $parameter, $tag, $base_tag);
return $this->defaultHandlerFunctionCallCompiler->compile($args, $this, $parameter, $tag, $tag);
}
if ($this->getPluginFromDefaultHandler($base_tag, Smarty::PLUGIN_BLOCK)) {
+2 -2
View File
@@ -168,7 +168,6 @@ class BCPluginsAdapter extends Base {
}
public function loadPluginsFromDir(string $path) {
foreach([
'function',
'modifier',
@@ -177,6 +176,7 @@ class BCPluginsAdapter extends Base {
'prefilter',
'postfilter',
'outputfilter',
'modifiercompiler',
] as $type) {
foreach (glob($path . $type . '.?*.php') as $filename) {
$pluginName = $this->getPluginNameFromFilename($filename);
@@ -226,4 +226,4 @@ class BCPluginsAdapter extends Base {
return $matches[1];
}
}
}
+2 -2
View File
@@ -320,7 +320,7 @@ class DefaultExtension extends Base {
break;
}
foreach ($var as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . htmlspecialchars(strtr($curr_key, $_replace)) .
'</b> =&gt; ' .
$this->smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
$depth--;
@@ -338,7 +338,7 @@ class DefaultExtension extends Base {
}
$objects[] = $var;
foreach ($object_vars as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . htmlspecialchars(strtr($curr_key, $_replace)) .
'</b> = ' . $this->smarty_modifier_debug_print_var($curr_val, $max, $length, ++$depth, $objects);
$depth--;
}
+77
View File
@@ -0,0 +1,77 @@
<?php
namespace Smarty\FunctionHandler;
use Smarty\Template;
/**
* Abstract implementation for function handlers which support custom attributes
*/
abstract class AttributeBase implements AttributeFunctionHandlerInterface
{
/**
* Array of names of required attribute required by tag
*
* @var array
*/
protected array $required_attributes = [];
/**
* Array of names of optional attribute required by tag
* use array('_any') if there is no restriction of attributes names
*
* @var array
*/
protected array $optional_attributes = [];
/**
* Shorttag attribute order defined by its names
*
* @var array
*/
protected array $shorttag_order = [];
/**
* Array of names of valid option flags
*
* @var array
*/
protected array $option_flags = [];
/**
* Return whether the output is cacheable.
* @var bool
*/
protected bool $cacheable = true;
/**
* Return whether the output is cacheable.
* @return bool
*/
public function isCacheable(): bool
{
return $this->cacheable;
}
/**
* Function body
* @param mixed $params The supplied parameters.
* @param Smarty\Template $template
* @return mixed
*/
abstract public function handle($params, Template $template): ?string;
/**
* Return the support attributes for this function.
* @return array<string, array>
*/
public function getSupportedAttributes(): array
{
return [
'required_attributes' => $this->required_attributes,
'optional_attributes' => $this->optional_attributes,
'shorttag_order' => $this->shorttag_order,
'option_flags' => $this->option_flags,
];
}
}
@@ -0,0 +1,15 @@
<?php
namespace Smarty\FunctionHandler;
/**
* Function handler interface with support for specifying supported properties
*/
interface AttributeFunctionHandlerInterface extends FunctionHandlerInterface
{
/**
* Returns an array with the supported attributes, flags, and shorttags
* @return array<string, array>
*/
public function getSupportedAttributes(): array;
}
+245 -238
View File
@@ -263,9 +263,9 @@ class TemplateParser
const TP_ARRAYOPEN = 57;
const TP_QUOTE = 58;
const TP_BACKTICK = 59;
const YY_NO_ACTION = 541;
const YY_ACCEPT_ACTION = 540;
const YY_ERROR_ACTION = 539;
const YY_NO_ACTION = 542;
const YY_ACCEPT_ACTION = 541;
const YY_ERROR_ACTION = 540;
const YY_SZ_ACTTAB = 2565;
public static $yy_action = array(
@@ -286,7 +286,7 @@ public static $yy_action = array(
278, 226, 302, 282, 200, 203, 446, 53, 4, 115,
302, 47, 22, 285, 41, 5, 54, 247, 248, 249,
1, 139, 137, 267, 202, 141, 6, 87, 14, 222,
540, 99, 112, 151, 15, 446, 217, 261, 218, 314,
541, 99, 112, 151, 15, 446, 217, 261, 218, 314,
224, 216, 21, 256, 233, 44, 9, 446, 45, 46,
278, 226, 325, 282, 268, 203, 53, 53, 4, 302,
302, 152, 257, 361, 320, 5, 54, 247, 248, 249,
@@ -338,194 +338,194 @@ public static $yy_action = array(
288, 362, 216, 327, 200, 114, 396, 362, 201, 119,
72, 336, 396, 37, 259, 101, 393, 19, 273, 274,
154, 258, 228, 339, 94, 281, 204, 283, 393, 289,
256, 300, 298, 301, 393, 38, 313, 288, 313, 216,
313, 313, 114, 207, 319, 201, 119, 72, 313, 313,
313, 313, 101, 221, 184, 273, 274, 156, 313, 313,
313, 95, 281, 204, 283, 313, 289, 256, 300, 298,
301, 313, 313, 313, 288, 313, 216, 313, 313, 108,
206, 319, 201, 122, 51, 313, 120, 313, 313, 101,
313, 184, 273, 274, 313, 313, 313, 313, 313, 281,
204, 283, 313, 289, 313, 300, 298, 301, 288, 313,
216, 313, 313, 114, 313, 313, 201, 122, 67, 313,
313, 313, 313, 101, 313, 313, 273, 274, 313, 313,
313, 313, 313, 281, 204, 283, 313, 289, 313, 300,
298, 301, 288, 313, 216, 313, 313, 114, 212, 313,
201, 122, 67, 313, 313, 313, 313, 101, 313, 313,
273, 274, 313, 313, 313, 313, 313, 281, 204, 283,
313, 289, 313, 300, 298, 301, 288, 313, 216, 313,
313, 114, 205, 313, 201, 119, 72, 313, 313, 313,
313, 101, 313, 313, 273, 274, 313, 313, 313, 313,
313, 281, 204, 283, 313, 289, 313, 300, 298, 301,
313, 313, 313, 288, 313, 216, 313, 313, 114, 313,
318, 201, 122, 78, 313, 313, 313, 313, 101, 313,
482, 273, 274, 482, 313, 313, 313, 482, 281, 204,
283, 313, 289, 209, 211, 298, 301, 288, 313, 216,
313, 313, 108, 313, 313, 201, 122, 58, 313, 238,
313, 313, 101, 313, 313, 273, 274, 313, 313, 482,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
118, 64, 313, 313, 313, 313, 101, 313, 313, 273,
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
114, 313, 313, 196, 117, 59, 313, 313, 313, 313,
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
313, 216, 313, 313, 114, 313, 313, 201, 104, 84,
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
313, 201, 105, 83, 313, 313, 313, 313, 101, 313,
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
313, 313, 114, 313, 313, 201, 122, 55, 313, 313,
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
122, 66, 313, 313, 313, 313, 101, 313, 313, 273,
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
114, 313, 313, 201, 104, 56, 313, 313, 313, 313,
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
313, 216, 313, 313, 114, 313, 313, 201, 122, 65,
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
313, 201, 122, 57, 313, 313, 313, 313, 101, 313,
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
313, 313, 114, 313, 313, 201, 122, 58, 313, 313,
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
122, 68, 313, 313, 313, 313, 101, 313, 313, 273,
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
114, 313, 313, 201, 122, 69, 313, 313, 313, 313,
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
313, 216, 313, 313, 114, 313, 313, 201, 122, 70,
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
313, 201, 122, 71, 313, 313, 313, 313, 101, 313,
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
313, 313, 114, 313, 313, 201, 122, 73, 313, 313,
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 288, 313, 216, 313, 313, 114, 313, 313, 195,
122, 61, 313, 313, 313, 313, 101, 313, 313, 273,
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
114, 313, 313, 201, 122, 62, 313, 313, 313, 313,
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
313, 216, 313, 313, 114, 313, 313, 201, 122, 63,
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
300, 298, 301, 288, 313, 216, 313, 313, 114, 313,
313, 201, 122, 74, 313, 313, 313, 313, 101, 313,
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
313, 313, 114, 313, 313, 201, 122, 75, 313, 313,
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
122, 76, 313, 313, 313, 313, 101, 313, 313, 273,
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
114, 313, 313, 201, 122, 77, 313, 313, 313, 313,
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
313, 216, 313, 313, 114, 313, 313, 201, 122, 79,
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
210, 298, 301, 288, 313, 216, 313, 313, 114, 313,
313, 201, 122, 80, 313, 313, 313, 313, 101, 313,
313, 273, 274, 313, 313, 313, 313, 313, 281, 204,
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
313, 313, 114, 313, 313, 201, 122, 81, 313, 313,
313, 313, 101, 313, 313, 273, 274, 313, 313, 313,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 288, 313, 216, 313, 313, 114, 313, 313, 201,
122, 82, 313, 313, 313, 313, 101, 313, 313, 273,
274, 313, 313, 313, 313, 313, 281, 204, 283, 313,
289, 313, 300, 298, 301, 288, 313, 216, 313, 313,
114, 313, 313, 201, 122, 50, 313, 313, 313, 313,
101, 313, 313, 273, 274, 313, 313, 313, 313, 313,
281, 204, 283, 313, 289, 313, 300, 298, 301, 288,
313, 216, 313, 313, 114, 313, 313, 201, 122, 52,
313, 313, 313, 313, 101, 313, 313, 273, 274, 313,
313, 313, 313, 313, 281, 204, 283, 313, 289, 313,
300, 298, 301, 288, 313, 216, 168, 313, 114, 313,
313, 201, 134, 313, 313, 313, 256, 313, 101, 47,
22, 285, 41, 313, 313, 313, 313, 333, 281, 204,
283, 313, 289, 313, 300, 298, 301, 288, 313, 216,
145, 313, 114, 313, 313, 201, 128, 313, 313, 313,
256, 313, 101, 47, 22, 285, 41, 313, 313, 313,
313, 287, 281, 204, 283, 315, 289, 313, 300, 298,
301, 247, 248, 249, 2, 313, 313, 313, 313, 313,
6, 87, 259, 313, 313, 19, 112, 313, 14, 258,
217, 261, 218, 313, 15, 39, 313, 14, 14, 42,
43, 286, 12, 15, 15, 313, 313, 313, 42, 43,
286, 12, 313, 313, 313, 313, 293, 294, 295, 296,
308, 27, 313, 313, 315, 293, 294, 295, 296, 313,
247, 248, 249, 2, 313, 313, 313, 110, 313, 6,
87, 313, 313, 313, 313, 112, 313, 313, 148, 217,
261, 218, 313, 42, 43, 286, 12, 313, 42, 43,
286, 12, 313, 313, 313, 313, 313, 313, 313, 313,
293, 294, 295, 296, 313, 293, 294, 295, 296, 309,
27, 313, 313, 240, 241, 242, 133, 223, 313, 247,
248, 249, 1, 313, 482, 313, 313, 482, 6, 87,
3, 482, 466, 313, 112, 313, 276, 313, 217, 261,
218, 288, 313, 216, 313, 313, 114, 313, 313, 201,
132, 313, 313, 313, 313, 313, 101, 313, 466, 313,
313, 466, 313, 482, 313, 466, 281, 204, 283, 313,
289, 313, 300, 298, 301, 313, 288, 313, 216, 313,
200, 114, 313, 313, 201, 123, 313, 313, 313, 313,
313, 101, 365, 313, 313, 313, 230, 313, 313, 313,
313, 281, 204, 283, 14, 289, 313, 300, 298, 301,
15, 313, 288, 446, 216, 313, 169, 114, 313, 313,
201, 124, 313, 313, 313, 446, 256, 101, 313, 47,
22, 285, 41, 313, 313, 313, 313, 281, 204, 283,
313, 289, 313, 300, 298, 301, 313, 288, 313, 216,
313, 313, 114, 313, 313, 201, 125, 313, 313, 313,
313, 313, 101, 313, 313, 313, 313, 313, 313, 313,
313, 313, 281, 204, 283, 313, 289, 313, 300, 298,
301, 313, 313, 288, 313, 216, 313, 313, 114, 313,
313, 201, 126, 313, 313, 313, 313, 313, 101, 313,
313, 313, 313, 313, 313, 313, 313, 313, 281, 204,
283, 313, 289, 313, 300, 298, 301, 313, 288, 313,
216, 313, 313, 114, 313, 313, 201, 127, 313, 313,
313, 313, 313, 101, 313, 313, 313, 313, 313, 313,
313, 313, 313, 281, 204, 283, 313, 289, 313, 300,
298, 301, 313, 313, 288, 313, 216, 223, 313, 114,
313, 313, 201, 131, 482, 313, 313, 482, 313, 101,
313, 482, 466, 313, 313, 313, 276, 313, 313, 281,
204, 283, 313, 289, 313, 300, 298, 301, 313, 313,
409, 313, 313, 313, 313, 313, 313, 313, 466, 313,
313, 466, 313, 482, 223, 466, 292, 313, 313, 313,
313, 482, 313, 313, 482, 313, 313, 36, 482, 466,
313, 223, 446, 276, 409, 409, 409, 409, 482, 313,
313, 482, 313, 313, 446, 482, 466, 313, 313, 30,
276, 409, 409, 409, 409, 466, 482, 313, 466, 482,
482, 313, 466, 482, 466, 313, 313, 313, 276, 313,
313, 313, 466, 313, 313, 466, 332, 482, 313, 466,
313, 313, 313, 313, 313, 331, 42, 43, 286, 12,
466, 313, 313, 466, 313, 482, 313, 466, 313, 42,
43, 286, 12, 293, 294, 295, 296, 307, 313, 42,
43, 286, 12, 185, 313, 313, 293, 294, 295, 296,
186, 313, 313, 313, 322, 313, 293, 294, 295, 296,
42, 43, 286, 12, 31, 313, 42, 43, 286, 12,
313, 334, 313, 42, 43, 286, 12, 293, 294, 295,
296, 313, 313, 293, 294, 295, 296, 313, 313, 313,
256, 300, 298, 301, 393, 38, 314, 288, 314, 216,
314, 314, 114, 207, 319, 201, 119, 72, 314, 314,
314, 314, 101, 221, 184, 273, 274, 156, 314, 314,
314, 95, 281, 204, 283, 314, 289, 256, 300, 298,
301, 314, 314, 314, 288, 314, 216, 314, 314, 108,
206, 319, 201, 122, 51, 314, 120, 314, 314, 101,
314, 184, 273, 274, 314, 314, 314, 314, 314, 281,
204, 283, 314, 289, 314, 300, 298, 301, 288, 314,
216, 314, 314, 114, 314, 314, 201, 122, 67, 314,
314, 314, 314, 101, 314, 314, 273, 274, 314, 314,
314, 314, 314, 281, 204, 283, 314, 289, 314, 300,
298, 301, 288, 314, 216, 314, 314, 114, 212, 314,
201, 122, 67, 314, 314, 314, 314, 101, 314, 314,
273, 274, 314, 314, 314, 314, 314, 281, 204, 283,
314, 289, 314, 300, 298, 301, 288, 314, 216, 314,
314, 114, 205, 314, 201, 119, 72, 314, 314, 314,
314, 101, 314, 314, 273, 274, 314, 314, 314, 314,
314, 281, 204, 283, 314, 289, 314, 300, 298, 301,
314, 314, 314, 288, 314, 216, 314, 314, 114, 314,
318, 201, 122, 78, 314, 314, 314, 314, 101, 314,
482, 273, 274, 482, 314, 314, 314, 482, 281, 204,
283, 314, 289, 209, 211, 298, 301, 288, 314, 216,
314, 314, 108, 314, 314, 201, 122, 58, 314, 238,
314, 314, 101, 314, 314, 273, 274, 314, 314, 482,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
118, 64, 314, 314, 314, 314, 101, 314, 314, 273,
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
114, 314, 314, 196, 117, 59, 314, 314, 314, 314,
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
314, 216, 314, 314, 114, 314, 314, 201, 104, 84,
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
314, 201, 105, 83, 314, 314, 314, 314, 101, 314,
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
314, 314, 114, 314, 314, 201, 122, 55, 314, 314,
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
122, 66, 314, 314, 314, 314, 101, 314, 314, 273,
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
114, 314, 314, 201, 104, 56, 314, 314, 314, 314,
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
314, 216, 314, 314, 114, 314, 314, 201, 122, 65,
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
314, 201, 122, 57, 314, 314, 314, 314, 101, 314,
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
314, 314, 114, 314, 314, 201, 122, 58, 314, 314,
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
122, 68, 314, 314, 314, 314, 101, 314, 314, 273,
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
114, 314, 314, 201, 122, 69, 314, 314, 314, 314,
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
314, 216, 314, 314, 114, 314, 314, 201, 122, 70,
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
314, 201, 122, 71, 314, 314, 314, 314, 101, 314,
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
314, 314, 114, 314, 314, 201, 122, 73, 314, 314,
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 288, 314, 216, 314, 314, 114, 314, 314, 195,
122, 61, 314, 314, 314, 314, 101, 314, 314, 273,
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
114, 314, 314, 201, 122, 62, 314, 314, 314, 314,
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
314, 216, 314, 314, 114, 314, 314, 201, 122, 63,
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
300, 298, 301, 288, 314, 216, 314, 314, 114, 314,
314, 201, 122, 74, 314, 314, 314, 314, 101, 314,
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
314, 314, 114, 314, 314, 201, 122, 75, 314, 314,
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
122, 76, 314, 314, 314, 314, 101, 314, 314, 273,
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
114, 314, 314, 201, 122, 77, 314, 314, 314, 314,
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
314, 216, 314, 314, 114, 314, 314, 201, 122, 79,
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
210, 298, 301, 288, 314, 216, 314, 314, 114, 314,
314, 201, 122, 80, 314, 314, 314, 314, 101, 314,
314, 273, 274, 314, 314, 314, 314, 314, 281, 204,
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
314, 314, 114, 314, 314, 201, 122, 81, 314, 314,
314, 314, 101, 314, 314, 273, 274, 314, 314, 314,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 288, 314, 216, 314, 314, 114, 314, 314, 201,
122, 82, 314, 314, 314, 314, 101, 314, 314, 273,
274, 314, 314, 314, 314, 314, 281, 204, 283, 314,
289, 314, 300, 298, 301, 288, 314, 216, 314, 314,
114, 314, 314, 201, 122, 50, 314, 314, 314, 314,
101, 314, 314, 273, 274, 314, 314, 314, 314, 314,
281, 204, 283, 314, 289, 314, 300, 298, 301, 288,
314, 216, 314, 314, 114, 314, 314, 201, 122, 52,
314, 314, 314, 314, 101, 314, 314, 273, 274, 314,
314, 314, 314, 314, 281, 204, 283, 314, 289, 314,
300, 298, 301, 288, 314, 216, 168, 314, 114, 314,
314, 201, 134, 314, 314, 314, 256, 314, 101, 47,
22, 285, 41, 314, 314, 314, 314, 333, 281, 204,
283, 314, 289, 314, 300, 298, 301, 288, 314, 216,
145, 314, 114, 314, 314, 201, 128, 314, 314, 314,
256, 314, 101, 47, 22, 285, 41, 314, 314, 314,
314, 287, 281, 204, 283, 315, 289, 314, 300, 298,
301, 247, 248, 249, 2, 314, 313, 314, 314, 314,
6, 87, 259, 314, 314, 19, 112, 314, 14, 258,
217, 261, 218, 314, 15, 39, 314, 14, 14, 42,
43, 286, 12, 15, 15, 314, 314, 314, 42, 43,
286, 12, 314, 314, 314, 314, 293, 294, 295, 296,
308, 27, 314, 314, 315, 293, 294, 295, 296, 314,
247, 248, 249, 2, 314, 313, 314, 110, 314, 6,
87, 314, 314, 314, 314, 112, 314, 314, 148, 217,
261, 218, 314, 42, 43, 286, 12, 314, 42, 43,
286, 12, 314, 314, 314, 314, 314, 314, 314, 314,
293, 294, 295, 296, 314, 293, 294, 295, 296, 309,
27, 314, 314, 240, 241, 242, 133, 223, 314, 247,
248, 249, 1, 314, 482, 314, 314, 482, 6, 87,
3, 482, 466, 314, 112, 314, 276, 314, 217, 261,
218, 288, 314, 216, 314, 314, 114, 314, 314, 201,
132, 314, 314, 314, 314, 314, 101, 314, 466, 314,
314, 466, 314, 482, 314, 466, 281, 204, 283, 314,
289, 314, 300, 298, 301, 314, 288, 314, 216, 314,
200, 114, 314, 314, 201, 123, 314, 314, 314, 314,
314, 101, 365, 314, 314, 314, 230, 314, 314, 314,
314, 281, 204, 283, 14, 289, 314, 300, 298, 301,
15, 314, 288, 446, 216, 314, 169, 114, 314, 314,
201, 124, 314, 314, 314, 446, 256, 101, 314, 47,
22, 285, 41, 314, 314, 314, 314, 281, 204, 283,
314, 289, 314, 300, 298, 301, 314, 288, 314, 216,
314, 314, 114, 314, 314, 201, 125, 314, 314, 314,
314, 314, 101, 314, 314, 314, 314, 314, 314, 314,
314, 314, 281, 204, 283, 314, 289, 314, 300, 298,
301, 314, 314, 288, 314, 216, 314, 314, 114, 314,
314, 201, 126, 314, 314, 314, 314, 314, 101, 314,
314, 314, 314, 314, 314, 314, 314, 314, 281, 204,
283, 314, 289, 314, 300, 298, 301, 314, 288, 314,
216, 314, 314, 114, 314, 314, 201, 127, 314, 314,
314, 314, 314, 101, 314, 314, 314, 314, 314, 314,
314, 314, 314, 281, 204, 283, 314, 289, 314, 300,
298, 301, 314, 314, 288, 314, 216, 223, 314, 114,
314, 314, 201, 131, 482, 314, 314, 482, 314, 101,
314, 482, 466, 314, 314, 314, 276, 314, 314, 281,
204, 283, 314, 289, 314, 300, 298, 301, 314, 314,
409, 314, 314, 314, 314, 314, 314, 314, 466, 314,
314, 466, 314, 482, 223, 466, 292, 314, 314, 314,
314, 482, 314, 314, 482, 314, 314, 36, 482, 466,
314, 223, 446, 276, 409, 409, 409, 409, 482, 314,
314, 482, 314, 314, 446, 482, 466, 314, 314, 30,
276, 409, 409, 409, 409, 466, 482, 314, 466, 482,
482, 314, 466, 482, 466, 314, 314, 314, 276, 314,
314, 314, 466, 314, 314, 466, 332, 482, 314, 466,
314, 314, 314, 314, 314, 331, 42, 43, 286, 12,
466, 314, 314, 466, 314, 482, 314, 466, 314, 42,
43, 286, 12, 293, 294, 295, 296, 307, 314, 42,
43, 286, 12, 185, 314, 314, 293, 294, 295, 296,
186, 314, 314, 314, 322, 314, 293, 294, 295, 296,
42, 43, 286, 12, 31, 314, 42, 43, 286, 12,
314, 334, 314, 42, 43, 286, 12, 293, 294, 295,
296, 314, 314, 293, 294, 295, 296, 314, 314, 314,
293, 294, 295, 296, 42, 43, 286, 12, 42, 43,
286, 12, 482, 313, 313, 482, 313, 313, 313, 482,
466, 293, 294, 295, 296, 293, 294, 295, 296, 313,
313, 313, 259, 313, 313, 19, 313, 313, 313, 258,
313, 313, 313, 313, 313, 313, 466, 313, 14, 466,
150, 482, 313, 466, 15,
286, 12, 482, 314, 314, 482, 314, 314, 314, 482,
466, 293, 294, 295, 296, 293, 294, 295, 296, 314,
314, 314, 259, 314, 314, 19, 314, 314, 314, 258,
314, 314, 314, 314, 314, 314, 466, 314, 14, 466,
150, 482, 314, 466, 15,
);
public static $yy_lookahead = array(
2, 80, 100, 13, 102, 103, 1, 9, 10, 11,
@@ -1180,45 +1180,45 @@ public static $yy_action = array(
array(),
);
public static $yy_default = array(
350, 539, 539, 539, 524, 524, 539, 501, 501, 539,
452, 539, 539, 539, 539, 539, 539, 539, 539, 539,
539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
539, 539, 539, 539, 539, 539, 539, 539, 539, 539,
390, 369, 390, 539, 539, 539, 395, 539, 539, 539,
363, 539, 539, 539, 539, 539, 374, 500, 413, 420,
499, 525, 527, 526, 419, 421, 418, 422, 451, 449,
397, 401, 402, 392, 395, 363, 433, 539, 390, 539,
390, 390, 514, 454, 390, 390, 539, 539, 381, 340,
453, 466, 539, 404, 404, 404, 466, 466, 454, 390,
539, 390, 390, 384, 454, 539, 539, 404, 404, 404,
350, 540, 540, 540, 525, 525, 540, 501, 501, 524,
452, 540, 540, 540, 540, 540, 540, 540, 540, 540,
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
390, 369, 390, 540, 540, 540, 395, 540, 540, 540,
363, 540, 540, 540, 540, 540, 374, 500, 413, 420,
499, 526, 528, 527, 419, 421, 418, 422, 451, 449,
397, 401, 402, 392, 395, 363, 433, 540, 390, 540,
390, 390, 514, 454, 390, 390, 540, 540, 381, 340,
453, 466, 540, 404, 404, 404, 466, 466, 454, 390,
540, 390, 390, 384, 454, 540, 540, 404, 404, 404,
371, 386, 404, 411, 424, 425, 426, 412, 417, 454,
511, 424, 410, 348, 508, 453, 453, 453, 453, 453,
539, 468, 466, 482, 360, 370, 539, 373, 539, 378,
539, 379, 463, 464, 364, 366, 367, 368, 492, 466,
540, 468, 466, 482, 360, 370, 540, 373, 540, 378,
540, 379, 463, 464, 364, 366, 367, 368, 492, 466,
491, 494, 493, 457, 458, 459, 460, 380, 376, 377,
372, 382, 502, 385, 387, 503, 442, 466, 488, 515,
512, 348, 507, 507, 507, 466, 466, 433, 429, 433,
423, 423, 467, 433, 433, 423, 423, 346, 539, 539,
539, 423, 433, 443, 539, 539, 539, 539, 429, 539,
461, 461, 539, 429, 539, 539, 539, 539, 539, 539,
539, 539, 539, 539, 429, 431, 539, 513, 539, 482,
539, 539, 539, 539, 539, 438, 539, 539, 539, 398,
423, 423, 467, 433, 433, 423, 423, 346, 540, 540,
540, 423, 433, 443, 540, 540, 540, 540, 429, 540,
461, 461, 540, 429, 540, 540, 540, 540, 540, 540,
540, 540, 540, 540, 429, 431, 540, 513, 540, 482,
540, 540, 540, 540, 540, 438, 540, 540, 540, 398,
341, 342, 343, 344, 345, 347, 349, 351, 352, 353,
354, 355, 356, 357, 359, 388, 389, 484, 485, 486,
506, 383, 504, 505, 427, 436, 437, 446, 447, 465,
469, 470, 471, 405, 406, 407, 408, 409, 428, 430,
432, 434, 438, 439, 440, 414, 415, 416, 441, 444,
445, 479, 477, 516, 517, 518, 519, 455, 456, 490,
461, 462, 483, 498, 358, 489, 535, 536, 528, 529,
530, 533, 532, 534, 537, 538, 531, 521, 523, 522,
461, 462, 483, 498, 358, 489, 536, 537, 529, 530,
531, 534, 533, 535, 538, 539, 532, 521, 523, 522,
520, 495, 480, 478, 476, 473, 474, 475, 481, 496,
497, 435, 472, 510, 487, 482, 391, 375, 399, 403,
);
const YYNOCODE = 113;
const YYSTACKDEPTH = 500;
const YYNSTATE = 340;
const YYNRULE = 199;
const YYNRULE = 200;
const YYERRORSYMBOL = 60;
const YYERRSYMDT = 'yy0';
const YYFALLBACK = 0;
@@ -1463,6 +1463,7 @@ public static $yy_action = array(
'arraydef ::= ARRAYOPEN arrayelements CLOSEP',
'arrayelements ::= arrayelement',
'arrayelements ::= arrayelements COMMA arrayelement',
'arrayelements ::= arrayelements COMMA',
'arrayelements ::=',
'arrayelement ::= value APTR expr',
'arrayelement ::= ID APTR expr',
@@ -1977,6 +1978,7 @@ public static $yy_action = array(
array( 0 => 94, 1 => 3 ),
array( 0 => 108, 1 => 1 ),
array( 0 => 108, 1 => 3 ),
array( 0 => 108, 1 => 2 ),
array( 0 => 108, 1 => 0 ),
array( 0 => 109, 1 => 3 ),
array( 0 => 109, 1 => 3 ),
@@ -2022,7 +2024,7 @@ public static $yy_action = array(
106 => 6,
122 => 6,
182 => 6,
187 => 6,
188 => 6,
7 => 7,
8 => 8,
9 => 9,
@@ -2131,7 +2133,7 @@ public static $yy_action = array(
123 => 123,
124 => 124,
126 => 126,
184 => 126,
185 => 126,
127 => 127,
128 => 128,
129 => 129,
@@ -2149,7 +2151,7 @@ public static $yy_action = array(
141 => 141,
142 => 142,
143 => 143,
188 => 143,
189 => 143,
144 => 144,
146 => 146,
147 => 147,
@@ -2181,18 +2183,19 @@ public static $yy_action = array(
180 => 180,
181 => 180,
183 => 183,
185 => 185,
184 => 184,
186 => 186,
189 => 189,
187 => 187,
190 => 190,
191 => 191,
192 => 192,
195 => 192,
193 => 193,
196 => 193,
194 => 194,
197 => 197,
197 => 194,
195 => 195,
198 => 198,
199 => 199,
);
// line 245 "src/Parser/TemplateParser.y"
public function yy_r0(){
@@ -2961,46 +2964,50 @@ public static $yy_action = array(
public function yy_r183(){
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor;
}
// line 1328 "src/Parser/TemplateParser.y"
public function yy_r185(){
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;
// line 1324 "src/Parser/TemplateParser.y"
public function yy_r184(){
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.',';
}
// line 1332 "src/Parser/TemplateParser.y"
public function yy_r186(){
public function yy_r186(){
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;
}
// line 1336 "src/Parser/TemplateParser.y"
public function yy_r187(){
$this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor;
}
// line 1348 "src/Parser/TemplateParser.y"
public function yy_r189(){
// line 1352 "src/Parser/TemplateParser.y"
public function yy_r190(){
$this->compiler->leaveDoubleQuote();
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php($this);
}
// line 1354 "src/Parser/TemplateParser.y"
public function yy_r190(){
// line 1358 "src/Parser/TemplateParser.y"
public function yy_r191(){
$this->yystack[$this->yyidx + -1]->minor->append_subtree($this, $this->yystack[$this->yyidx + 0]->minor);
$this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
}
// line 1359 "src/Parser/TemplateParser.y"
public function yy_r191(){
$this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor);
}
// line 1363 "src/Parser/TemplateParser.y"
public function yy_r192(){
$this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor);
$this->_retvalue = new Dq($this, $this->yystack[$this->yyidx + 0]->minor);
}
// line 1367 "src/Parser/TemplateParser.y"
public function yy_r193(){
$this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')');
$this->_retvalue = new Code('(string)'.$this->yystack[$this->yyidx + -1]->minor);
}
// line 1371 "src/Parser/TemplateParser.y"
public function yy_r194(){
$this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')');
$this->_retvalue = new Code('(string)('.$this->yystack[$this->yyidx + -1]->minor.')');
}
// line 1383 "src/Parser/TemplateParser.y"
public function yy_r197(){
$this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor);
// line 1375 "src/Parser/TemplateParser.y"
public function yy_r195(){
$this->_retvalue = new Code('(string)$_smarty_tpl->getValue(\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\')');
}
// line 1387 "src/Parser/TemplateParser.y"
public function yy_r198(){
$this->_retvalue = new Tag($this, $this->yystack[$this->yyidx + 0]->minor);
}
// line 1391 "src/Parser/TemplateParser.y"
public function yy_r199(){
$this->_retvalue = new DqContent($this->yystack[$this->yyidx + 0]->minor);
}
+4
View File
@@ -1321,6 +1321,10 @@ arrayelements(res) ::= arrayelements(a1) COMMA arrayelement(a). {
res = a1.','.a;
}
arrayelements(res) ::= arrayelements(a) COMMA. {
res = a.',';
}
arrayelements ::= . {
return;
}
+1 -1
View File
@@ -31,7 +31,7 @@ class StringEval extends RecompiledPlugin
*
* @return void
*/
public function populate(\Smarty\Template\Source $source, \Smarty\Template $_template = null)
public function populate(\Smarty\Template\Source $source, ?\Smarty\Template $_template = null)
{
$source->uid = sha1($source->name);
$source->timestamp = $source->exists = true;
+1 -1
View File
@@ -54,7 +54,7 @@ class Smarty extends \Smarty\TemplateBase {
/**
* smarty version
*/
const SMARTY_VERSION = '5.4.3';
const SMARTY_VERSION = '5.7.0';
/**
* define caching modes
+1 -1
View File
@@ -104,7 +104,7 @@ abstract class TemplateBase extends Data {
}
// register the object
$smarty->registered_objects[$object_name] =
[$object, (array)$allowed_methods_properties, (boolean)$format, (array)$block_methods];
[$object, (array)$allowed_methods_properties, (bool)$format, (array)$block_methods];
return $this;
}
@@ -0,0 +1,193 @@
<?php
use Smarty\Compile\AttributeCompiler;
use Smarty\Compiler\Template;
class AttributeCompilerTest extends PHPUnit\Framework\TestCase
{
/**
* The template compiler.
*/
private $template_compiler;
/**
* The attributes
*/
private $attributes = [];
/**
* @inheritDoc
* Set up attribute compiler class
*/
protected function setUp(): void
{
$this->template_compiler = $this->createMock(Template::class);
// reset attributes to empty arrays
$this->attributes = [
'required_attributes' => [],
'optional_attributes' => [],
'shorttag_order' => [],
'option_flags' => [],
];
}
/**
* Create the attribute compiler for testing.
*/
private function createAttributeCompiler() {
return new AttributeCompiler(
$this->attributes['required_attributes'],
$this->attributes['optional_attributes'],
$this->attributes['shorttag_order'],
$this->attributes['option_flags']
);
}
/**
* Tests shorthand attribute compiling.
*/
public function testAttributeCompiler(): void
{
$this->attributes['shorttag_order'] = ['shorttag'];
$this->attributes['required_attributes'] = ['required'];
$this->attributes['option_flags'] = ['option', 'option_two'];
$payload = [
0 => 'shorttag value',
1 => [
'required' => 'required_value'
],
2 => 'option',
];
$this->assertEquals(
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, $payload),
[
'shorttag' => 'shorttag value',
'required' => 'required_value',
'option' => true,
'option_two' => false,
]
);
}
/**
* Tests normal optional attribute compiling.
*/
public function testAttributeCompilerOptionalArguments(): void
{
$this->attributes['optional_attributes'] = ['optional'];
$payload = [
0 => [
'optional' => 'optional value'
],
];
$this->assertEquals(
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, $payload),
[
'optional' => 'optional value',
]
);
$this->assertEquals(
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, []),
[]
);
}
/**
* Tests any attribute compiling.
*/
public function testAttributeCompilerAnyOptionalArguments(): void
{
$this->attributes['optional_attributes'] = ['_any'];
$payload = [
0 => [
'optional' => 'optional value'
],
1 => [
'optional_two' => 'optional value two'
],
];
$this->assertEquals(
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, $payload),
[
'optional' => 'optional value',
'optional_two' => 'optional value two',
]
);
}
/**
* Test if the attribute compiler tries to throw a too many shorthand attributes error.
*/
public function testAttributeCompilerTooManyShorthands(): void
{
$payload = [
0 => 'option one',
];
$this->template_compiler
->expects(self::once())
->method('trigger_template_error')
->with('too many shorthand attributes', null, true);
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, $payload);
}
/**
* Test if the attribute compiler tries to throw a missing required attribute error.
*/
public function testAttributeCompilerWithMissingRequiredAttributes(): void
{
$this->attributes['required_attributes'] = ['required'];
$this->template_compiler
->expects(self::once())
->method('trigger_template_error')
->with('missing \'required\' attribute', null, true);
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, []);
}
/**
* Test if the attribute compiler tries to throw a illegal value template error.
*/
public function testAttributeCompilerWithInvalidOptionAttribute(): void
{
$this->attributes['option_flags'] = ['option'];
$this->template_compiler
->expects(self::once())
->method('trigger_template_error')
->with('illegal value \'\'foo\'\' for options flag \'option\'', null, true);
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, [0 => ['option' => 'foo']]);
}
/**
* Test if the attribute compiler tries to throw an unexpected attribute error.
*/
public function testAttributeCompilerWithInvalidUnexpectedAttribute(): void
{
$this->template_compiler
->expects(self::once())
->method('trigger_template_error')
->with('unexpected \'unexpected\' attribute', null, true);
$this->createAttributeCompiler()
->getAttributes($this->template_compiler, [0 => ['unexpected' => 'bar']]);
}
}
@@ -0,0 +1,62 @@
<?php
use Smarty\Compile\FunctionCallCompiler;
use Smarty\Compiler\Template;
use Smarty\FunctionHandler\AttributeFunctionHandlerInterface;
use Smarty\Smarty;
class FunctionCallCompilerTest extends PHPUnit\Framework\TestCase
{
/**
* @inheritDoc
* Set up attribute compiler class
*/
protected function setUp(): void
{
$this->smarty = $this->createMock(Smarty::class);
$this->template_compiler = $this->createMock(Template::class);
$this->template_compiler
->expects(self::once())
->method('getSmarty')
->willReturn($this->smarty);
}
public function testAttributeFunctionHandlerInterface(): void
{
$attribute_function_handler = $this->createMock(AttributeFunctionHandlerInterface::class);
$attribute_function_handler
->expects(self::once())
->method('getSupportedAttributes')
->willReturn([
'required_attributes' => ['required'],
'optional_attributes' => ['optional'],
'shorttag_order' => ['short'],
'option_flags' => ['option'],
]);
$args = [
0 => 'short',
1 => 'option',
2 => [
'optional' => 'optional',
],
3 => [
'required' => 'required',
],
];
$this->smarty
->expects(self::once())
->method('getFunctionHandler')
->with('method')
->willReturn($attribute_function_handler);
$function_call_compiler = new FunctionCallCompiler();
$this->assertEquals(
$function_call_compiler->compile($args, $this->template_compiler, [], null, 'method'),
'$_smarty_tpl->getSmarty()->getFunctionHandler(\'method\')->handle(array(\'short\'=>short,\'option\'=>1,\'optional\'=>optional,\'required\'=>required), $_smarty_tpl)'
);
}
}
@@ -192,6 +192,15 @@ class RegisterFunctionTest extends PHPUnit_Smarty
];
}
/**
* test registerPlugin for function name ending in 'close' #1122
*/
public function testRegisterFunctionEndingInClose()
{
$this->smarty->registerPlugin(Smarty::PLUGIN_FUNCTION, 'window_close', 'myfunction');
$this->assertEquals('hello world 1', $this->smarty->fetch('eval:{window_close value=1}'));
}
}
function myfunction($params, $smarty)
@@ -70,6 +70,8 @@ class ArrayTest extends PHPUnit_Smarty
array('{$foo=[1,2,[7,8,9],4,5]}{$x=2}{$foo.$x.0}', '7', 'T13', $i++),
array('{$foo=[1,2,[7,8,9],4,5]}{$x=0}{$foo.2.$x}', '7', 'T14', $i++),
array('{$foo=[1,2,[7,8,9],4,5]}{$x=[1,0]}{$foo.2.{$x.1}}', '7', 'T15', $i++),
array('{$foo=[1,2,3,4,5,]}{foreach $foo as $bar}{$bar}{/foreach}', '12345', 'T16', $i++),
array('{$foo=[1,2,3,4,5,[6,7,8,],]}{$foo[5][2]}', '8', 'T17', $i++),
);
}
}
+10
View File
@@ -0,0 +1,10 @@
FROM php:8.5-rc-cli-bullseye
## 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