Fix comments and indentation (#637)

* Fix indentation

* Replace url of smarty.net from http to https

* Fix breaking links

Replace from http://smarty.php.net to https://www.smarty.net

* Replace link from http to https

* Fix CHANGELOG.md
This commit is contained in:
T. Nishino
2021-08-19 05:41:34 +09:00
committed by GitHub
parent 1a052b6a77
commit c5cc763802
99 changed files with 405 additions and 406 deletions

View File

@@ -32,7 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.1.37] - 2021-01-07 ## [3.1.37] - 2021-01-07
### Changed ### Changed
- Dropped support for PHP versions lower than PHP7.1 (and disabled unit tests for 7.1)
- Changed error handlers and handling of undefined constants for php8-compatibility (set $errcontext argument optional) https://github.com/smarty-php/smarty/issues/605 - 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 - Changed expected error levels in unit tests for php8-compatibility
- Travis unit tests now run for all php versions >= 5.3, including php8 - Travis unit tests now run for all php versions >= 5.3, including php8
@@ -337,7 +336,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20.09.2016 20.09.2016
- bugfix some $smarty special template variables are no longer accessed as real variable. - bugfix some $smarty special template variables are no longer accessed as real variable.
using them on calls like {if isset($smarty.foo)} or {if empty($smarty.foo)} will fail using them on calls like {if isset($smarty.foo)} or {if empty($smarty.foo)} will fail
http://www.smarty.net/forums/viewtopic.php?t=26222 https://www.smarty.net/forums/viewtopic.php?t=26222
- temporary fix for https://github.com/smarty-php/smarty/issues/293 main reason still under investigation - temporary fix for https://github.com/smarty-php/smarty/issues/293 main reason still under investigation
- improvement new tags {block_parent} {block_child} in template inheritance - improvement new tags {block_parent} {block_child} in template inheritance
@@ -349,7 +348,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291 - bugfix assigning a variable in if condition by function like {if $value = array_shift($array)} the function got called twice https://github.com/smarty-php/smarty/issues/291
- bugfix function plugins called with assign attribute like {foo assign='bar'} did not output returned content because - bugfix function plugins called with assign attribute like {foo assign='bar'} did not output returned content because
because assumption was made that it was assigned to a variable https://github.com/smarty-php/smarty/issues/292 because assumption was made that it was assigned to a variable https://github.com/smarty-php/smarty/issues/292
- bugfix calling $smarty->isCached() on a not existing cache file with $smarty->cache_locking = true; could cause a 10 second delay http://www.smarty.net/forums/viewtopic.php?t=26282 - bugfix calling $smarty->isCached() on a not existing cache file with $smarty->cache_locking = true; could cause a 10 second delay https://www.smarty.net/forums/viewtopic.php?t=26282
- improvement make Smarty::clearCompiledTemplate() on custom resource independent from changes of templateId computation - improvement make Smarty::clearCompiledTemplate() on custom resource independent from changes of templateId computation
11.09.2016 11.09.2016

2
README
View File

@@ -51,7 +51,7 @@ $smarty->unregisterFilter(...)
Please refer to the online documentation for all specific changes: Please refer to the online documentation for all specific changes:
http://www.smarty.net/documentation https://www.smarty.net/documentation
---- ----

View File

@@ -5,7 +5,7 @@
"keywords": [ "keywords": [
"templating" "templating"
], ],
"homepage": "http://www.smarty.net", "homepage": "https://www.smarty.net",
"license": "LGPL-3.0", "license": "LGPL-3.0",
"authors": [ "authors": [
{ {
@@ -27,7 +27,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/smarty-php/smarty/issues", "issues": "https://github.com/smarty-php/smarty/issues",
"forum": "http://www.smarty.net/forums/" "forum": "https://www.smarty.net/forums/"
}, },
"require": { "require": {
"php": "^7.1 || ^8.0" "php": "^7.1 || ^8.0"

View File

@@ -20,7 +20,7 @@
* Smarty mailing list. Send a blank e-mail to * Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com * smarty-discussion-subscribe@googlegroups.com
* *
* @link http://www.smarty.net/ * @link https://www.smarty.net/
* @copyright 2018 New Digital Group, Inc. * @copyright 2018 New Digital Group, Inc.
* @copyright 2018 Uwe Tews * @copyright 2018 Uwe Tews
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>

View File

@@ -20,7 +20,7 @@
* - indent_char - string (" ") * - indent_char - string (" ")
* - wrap_boundary - boolean (true) * - wrap_boundary - boolean (true)
* *
* @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat} * @link https://www.smarty.net/manual/en/language.function.textformat.php {textformat}
* (Smarty online manual) * (Smarty online manual)
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -12,7 +12,7 @@
* Purpose: print out a counter value * Purpose: print out a counter value
* *
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @link http://www.smarty.net/manual/en/language.function.counter.php {counter} * @link https://www.smarty.net/manual/en/language.function.counter.php {counter}
* (Smarty online manual) * (Smarty online manual)
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -28,7 +28,7 @@
* {cycle name=row values="one,two,three" reset=true} * {cycle name=row values="one,two,three" reset=true}
* {cycle name=row} * {cycle name=row}
* *
* @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle} * @link https://www.smarty.net/manual/en/language.function.cycle.php {cycle}
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author credit to Mark Priatel <mpriatel@rogers.com> * @author credit to Mark Priatel <mpriatel@rogers.com>

View File

@@ -11,7 +11,7 @@
* Name: fetch * Name: fetch
* Purpose: fetch file, web or ftp data and display results * Purpose: fetch file, web or ftp data and display results
* *
* @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch} * @link https://www.smarty.net/manual/en/language.function.fetch.php {fetch}
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *

View File

@@ -29,7 +29,7 @@
* - assign (optional) - assign the output as an array to this variable * - assign (optional) - assign the output as an array to this variable
* - escape (optional) - escape the content (not value), defaults to true * - escape (optional) - escape the content (not value), defaults to true
* *
* @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes} * @link https://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
* (Smarty online manual) * (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com> * @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com> * @author credits to Monte Ohrt <monte at ohrt dot com>

View File

@@ -21,7 +21,7 @@
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT * - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
* - path_prefix - prefix for path output (optional, default empty) * - path_prefix - prefix for path output (optional, default empty)
* *
* @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image} * @link https://www.smarty.net/manual/en/language.function.html.image.php {html_image}
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author credits to Duda <duda@big.hu> * @author credits to Duda <duda@big.hu>

View File

@@ -21,7 +21,7 @@
* - id (optional) - string default not set * - id (optional) - string default not set
* - class (optional) - string default not set * - class (optional) - string default not set
* *
* @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image} * @link https://www.smarty.net/manual/en/language.function.html.options.php {html_image}
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de> * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>

View File

@@ -29,7 +29,7 @@
* {html_radios values=$ids name='box' separator='<br>' output=$names} * {html_radios values=$ids name='box' separator='<br>' output=$names}
* {html_radios values=$ids checked=$checked separator='<br>' output=$names} * {html_radios values=$ids checked=$checked separator='<br>' output=$names}
* *
* @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios} * @link https://www.smarty.net/manual/en/language.function.html.radios.php {html_radios}
* (Smarty online manual) * (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com> * @author Christopher Kvarme <christopher.kvarme@flashjab.com>
* @author credits to Monte Ohrt <monte at ohrt dot com> * @author credits to Monte Ohrt <monte at ohrt dot com>

View File

@@ -28,7 +28,7 @@
* - 2.0 complete rewrite for performance, * - 2.0 complete rewrite for performance,
* added attributes month_names, *_id * added attributes month_names, *_id
* *
* @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date} * @link https://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
* (Smarty online manual) * (Smarty online manual)
* @version 2.0 * @version 2.0
* @author Andrei Zmievski * @author Andrei Zmievski

View File

@@ -11,7 +11,7 @@
* Name: html_select_time * Name: html_select_time
* Purpose: Prints the dropdowns for time selection * Purpose: Prints the dropdowns for time selection
* *
* @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time} * @link https://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
* (Smarty online manual) * (Smarty online manual)
* @author Roberto Berto <roberto@berto.net> * @author Roberto Berto <roberto@berto.net>
* @author Monte Ohrt <monte AT ohrt DOT com> * @author Monte Ohrt <monte AT ohrt DOT com>

View File

@@ -38,7 +38,7 @@
* @author credit to Messju Mohr <messju at lammfellpuschen dot de> * @author credit to Messju Mohr <messju at lammfellpuschen dot de>
* @author credit to boots <boots dot smarty at yahoo dot com> * @author credit to boots <boots dot smarty at yahoo dot com>
* @version 1.1 * @version 1.1
* @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table} * @link https://www.smarty.net/manual/en/language.function.html.table.php {html_table}
* (Smarty online manual) * (Smarty online manual)
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -36,7 +36,7 @@
* {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"} * {mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
* {mailto address="me@domain.com" extra='class="mailto"'} * {mailto address="me@domain.com" extra='class="mailto"'}
* *
* @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto} * @link https://www.smarty.net/manual/en/language.function.mailto.php {mailto}
* (Smarty online manual) * (Smarty online manual)
* @version 1.2 * @version 1.2
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>

View File

@@ -12,7 +12,7 @@
* Name: math * Name: math
* Purpose: handle math computations in template * Purpose: handle math computations in template
* *
* @link http://www.smarty.net/manual/en/language.function.math.php {math} * @link https://www.smarty.net/manual/en/language.function.math.php {math}
* (Smarty online manual) * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *

View File

@@ -15,7 +15,7 @@
* - format: strftime format for output * - format: strftime format for output
* - default_date: default date if $string is empty * - default_date: default date if $string is empty
* *
* @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *
* @param string $string input date string * @param string $string input date string

View File

@@ -11,7 +11,7 @@
* Name: escape * Name: escape
* Purpose: escape string for output * Purpose: escape string for output
* *
* @link http://www.smarty.net/docs/en/language.modifier.escape * @link https://www.smarty.net/docs/en/language.modifier.escape
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *
* @param string $string input string * @param string $string input string

View File

@@ -11,7 +11,7 @@
* Name: mb_wordwrap * Name: mb_wordwrap
* Purpose: Wrap a string to a given number of characters * Purpose: Wrap a string to a given number of characters
* *
* @link http://php.net/manual/en/function.wordwrap.php for similarity * @link https://php.net/manual/en/function.wordwrap.php for similarity
* *
* @param string $str the string to wrap * @param string $str the string to wrap
* @param int $width the width of the output * @param int $width the width of the output

View File

@@ -11,7 +11,7 @@
* Name: regex_replace * Name: regex_replace
* Purpose: regular expression search/replace * Purpose: regular expression search/replace
* *
* @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php * @link https://www.smarty.net/manual/en/language.modifier.regex.replace.php
* regex_replace (Smarty online manual) * regex_replace (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *

View File

@@ -11,7 +11,7 @@
* Name: replace * Name: replace
* Purpose: simple search/replace * Purpose: simple search/replace
* *
* @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews * @author Uwe Tews
* *

View File

@@ -11,7 +11,7 @@
* Name: spacify * Name: spacify
* Purpose: add spaces between characters in a string * Purpose: add spaces between characters in a string
* *
* @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *
* @param string $string input string * @param string $string input string

View File

@@ -13,7 +13,7 @@
* optionally splitting in the middle of a word, and * optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle. * appending the $etc string or inserting $etc into the middle.
* *
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* *
* @param string $string input string * @param string $string input string

View File

@@ -14,7 +14,7 @@
* Input: string to catenate * Input: string to catenate
* Example: {$var|cat:"foo"} * Example: {$var|cat:"foo"}
* *
* @link http://smarty.php.net/manual/en/language.modifier.cat.php cat * @link https://www.smarty.net/manual/en/language.modifier.cat.php cat
* (Smarty online manual) * (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *

View File

@@ -11,7 +11,7 @@
* Name: count_characters * Name: count_characters
* Purpose: count the number of characters in a text * Purpose: count the number of characters in a text
* *
* @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online * @link https://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online
* manual) * manual)
* @author Uwe Tews * @author Uwe Tews
* *

View File

@@ -11,7 +11,7 @@
* Name: count_paragraphs * Name: count_paragraphs
* Purpose: count the number of paragraphs in a text * Purpose: count the number of paragraphs in a text
* *
* @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php * @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* count_paragraphs (Smarty online manual) * count_paragraphs (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *

View File

@@ -11,7 +11,7 @@
* Name: count_sentences * Name: count_sentences
* Purpose: count the number of sentences in a text * Purpose: count the number of sentences in a text
* *
* @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php * @link https://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
* count_sentences (Smarty online manual) * count_sentences (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *

View File

@@ -11,7 +11,7 @@
* Name: count_words * Name: count_words
* Purpose: count the number of words in a text * Purpose: count the number of words in a text
* *
* @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: default * Name: default
* Purpose: designate default value for empty variables * Purpose: designate default value for empty variables
* *
* @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: escape * Name: escape
* Purpose: escape string for output * Purpose: escape string for output
* *
* @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual) * @link https://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
* @author Rodney Rehm * @author Rodney Rehm
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: indent * Name: indent
* Purpose: indent lines of text * Purpose: indent lines of text
* *
* @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: lower * Name: lower
* Purpose: convert string to lowercase * Purpose: convert string to lowercase
* *
* @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com> * @author Monte Ohrt <monte at ohrt dot com>
* @author Uwe Tews * @author Uwe Tews
* *

View File

@@ -11,7 +11,7 @@
* Name: string_format * Name: string_format
* Purpose: format strings via sprintf * Purpose: format strings via sprintf
* *
* @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -14,7 +14,7 @@
* Example: {$var|strip} {$var|strip:"&nbsp;"} * Example: {$var|strip} {$var|strip:"&nbsp;"}
* Date: September 25th, 2002 * Date: September 25th, 2002
* *
* @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: strip_tags * Name: strip_tags
* Purpose: strip html tags from text * Purpose: strip html tags from text
* *
* @link http://www.smarty.net/docs/en/language.modifier.strip.tags.tpl strip_tags (Smarty online manual) * @link https://www.smarty.net/docs/en/language.modifier.strip.tags.tpl strip_tags (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: lower * Name: lower
* Purpose: convert string to uppercase * Purpose: convert string to uppercase
* *
* @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -11,7 +11,7 @@
* Name: wordwrap * Name: wordwrap
* Purpose: wrap a string of text at a given length * Purpose: wrap a string of text at a given length
* *
* @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual) * @link https://www.smarty.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
* @author Uwe Tews * @author Uwe Tews
* *
* @param array $params parameters * @param array $params parameters

View File

@@ -41,7 +41,7 @@ function smarty_outputfilter_trimwhitespace($source)
} }
} }
// Strip all HTML-Comments // Strip all HTML-Comments
// yes, even the ones in <script> - see http://stackoverflow.com/a/808850/515124 // yes, even the ones in <script> - see https://stackoverflow.com/a/808850/515124
$source = preg_replace('#<!--.*?-->#ms', '', $source); $source = preg_replace('#<!--.*?-->#ms', '', $source);
// capture html elements not to be messed with // capture html elements not to be messed with
$_offset = 0; $_offset = 0;

View File

@@ -219,9 +219,9 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_Compile_Private_Fo
if (isset($itemAttr[ 'index' ])) { if (isset($itemAttr[ 'index' ])) {
$output .= "{$itemVar}->index = -1;\n"; $output .= "{$itemVar}->index = -1;\n";
} }
$output .= "{$itemVar}->do_else = true;\n"; $output .= "{$itemVar}->do_else = true;\n";
$output .= "if (\$_from !== null) foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n"; $output .= "if (\$_from !== null) foreach (\$_from as {$keyTerm}{$itemVar}->value) {\n";
$output .= "{$itemVar}->do_else = false;\n"; $output .= "{$itemVar}->do_else = false;\n";
if (isset($attributes[ 'key' ]) && isset($itemAttr[ 'key' ])) { if (isset($attributes[ 'key' ]) && isset($itemAttr[ 'key' ])) {
$output .= "\$_smarty_tpl->tpl_vars['{$key}']->value = {$itemVar}->key;\n"; $output .= "\$_smarty_tpl->tpl_vars['{$key}']->value = {$itemVar}->key;\n";
} }

View File

@@ -121,7 +121,7 @@ abstract class Smarty_Internal_Data
* appends values to template variables * appends values to template variables
* *
* @api Smarty::append() * @api Smarty::append()
* @link http://www.smarty.net/docs/en/api.append.tpl * @link https://www.smarty.net/docs/en/api.append.tpl
* *
* @param array|string $tpl_var the template variable name(s) * @param array|string $tpl_var the template variable name(s)
* @param mixed $value the value to append * @param mixed $value the value to append
@@ -182,7 +182,7 @@ abstract class Smarty_Internal_Data
* Returns a single or all template variables * Returns a single or all template variables
* *
* @api Smarty::getTemplateVars() * @api Smarty::getTemplateVars()
* @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * @link https://www.smarty.net/docs/en/api.get.template.vars.tpl
* *
* @param string $varName variable name or null * @param string $varName variable name or null
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object

View File

@@ -31,7 +31,7 @@ class Smarty_Internal_ErrorHandler
public function activate() { public function activate() {
/* /*
Error muting is done because some people implemented custom error_handlers using Error muting is done because some people implemented custom error_handlers using
http://php.net/set_error_handler and for some reason did not understand the following paragraph: https://php.net/set_error_handler and for some reason did not understand the following paragraph:
It is important to remember that the standard PHP error handler is completely bypassed for the It is important to remember that the standard PHP error handler is completely bypassed for the
error types specified by error_types unless the callback function returns FALSE. error types specified by error_types unless the callback function returns FALSE.
@@ -54,7 +54,7 @@ class Smarty_Internal_ErrorHandler
/** /**
* Error Handler to mute expected messages * Error Handler to mute expected messages
* *
* @link http://php.net/set_error_handler * @link https://php.net/set_error_handler
* *
* @param integer $errno Error level * @param integer $errno Error level
* @param $errstr * @param $errstr

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_Append
* appends values to template variables * appends values to template variables
* *
* @api Smarty::append() * @api Smarty::append()
* @link http://www.smarty.net/docs/en/api.append.tpl * @link https://www.smarty.net/docs/en/api.append.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param array|string $tpl_var the template variable name(s) * @param array|string $tpl_var the template variable name(s)

View File

@@ -15,7 +15,7 @@ class Smarty_Internal_Method_AppendByRef
* appends values to template variables by reference * appends values to template variables by reference
* *
* @api Smarty::appendByRef() * @api Smarty::appendByRef()
* @link http://www.smarty.net/docs/en/api.append.by.ref.tpl * @link https://www.smarty.net/docs/en/api.append.by.ref.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string $tpl_var the template variable name * @param string $tpl_var the template variable name

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ClearAllAssign
* clear all the assigned template variables. * clear all the assigned template variables.
* *
* @api Smarty::clearAllAssign() * @api Smarty::clearAllAssign()
* @link http://www.smarty.net/docs/en/api.clear.all.assign.tpl * @link https://www.smarty.net/docs/en/api.clear.all.assign.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* *

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ClearAllCache
* Empty cache folder * Empty cache folder
* *
* @api Smarty::clearAllCache() * @api Smarty::clearAllCache()
* @link http://www.smarty.net/docs/en/api.clear.all.cache.tpl * @link https://www.smarty.net/docs/en/api.clear.all.cache.tpl
* *
* @param \Smarty $smarty * @param \Smarty $smarty
* @param integer $exp_time expiration time * @param integer $exp_time expiration time

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ClearAssign
* clear the given assigned template variable(s). * clear the given assigned template variable(s).
* *
* @api Smarty::clearAssign() * @api Smarty::clearAssign()
* @link http://www.smarty.net/docs/en/api.clear.assign.tpl * @link https://www.smarty.net/docs/en/api.clear.assign.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string|array $tpl_var the template variable(s) to clear * @param string|array $tpl_var the template variable(s) to clear

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ClearCache
* Empty cache for a specific template * Empty cache for a specific template
* *
* @api Smarty::clearCache() * @api Smarty::clearCache()
* @link http://www.smarty.net/docs/en/api.clear.cache.tpl * @link https://www.smarty.net/docs/en/api.clear.cache.tpl
* *
* @param \Smarty $smarty * @param \Smarty $smarty
* @param string $template_name template name * @param string $template_name template name

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ClearCompiledTemplate
* Delete compiled template file * Delete compiled template file
* *
* @api Smarty::clearCompiledTemplate() * @api Smarty::clearCompiledTemplate()
* @link http://www.smarty.net/docs/en/api.clear.compiled.template.tpl * @link https://www.smarty.net/docs/en/api.clear.compiled.template.tpl
* *
* @param \Smarty $smarty * @param \Smarty $smarty
* @param string $resource_name template name * @param string $resource_name template name

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ClearConfig
* clear a single or all config variables * clear a single or all config variables
* *
* @api Smarty::clearConfig() * @api Smarty::clearConfig()
* @link http://www.smarty.net/docs/en/api.clear.config.tpl * @link https://www.smarty.net/docs/en/api.clear.config.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string|null $name variable name or null * @param string|null $name variable name or null

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_ConfigLoad
* load a config file, optionally load just selected sections * load a config file, optionally load just selected sections
* *
* @api Smarty::configLoad() * @api Smarty::configLoad()
* @link http://www.smarty.net/docs/en/api.config.load.tpl * @link https://www.smarty.net/docs/en/api.config.load.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string $config_file filename * @param string $config_file filename
@@ -42,7 +42,7 @@ class Smarty_Internal_Method_ConfigLoad
* load a config file, optionally load just selected sections * load a config file, optionally load just selected sections
* *
* @api Smarty::configLoad() * @api Smarty::configLoad()
* @link http://www.smarty.net/docs/en/api.config.load.tpl * @link https://www.smarty.net/docs/en/api.config.load.tpl
* *
* @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data * @param \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template $data
* @param string $config_file filename * @param string $config_file filename

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_CreateData
* creates a data object * creates a data object
* *
* @api Smarty::createData() * @api Smarty::createData()
* @link http://www.smarty.net/docs/en/api.create.data.tpl * @link https://www.smarty.net/docs/en/api.create.data.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty * @param \Smarty_Internal_Template|\Smarty_Internal_Data|\Smarty_Data|\Smarty $parent next higher level of Smarty

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_GetConfigVars
* Returns a single or all config variables * Returns a single or all config variables
* *
* @api Smarty::getConfigVars() * @api Smarty::getConfigVars()
* @link http://www.smarty.net/docs/en/api.get.config.vars.tpl * @link https://www.smarty.net/docs/en/api.get.config.vars.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string $varname variable name or null * @param string $varname variable name or null

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_GetRegisteredObject
* return a reference to a registered object * return a reference to a registered object
* *
* @api Smarty::getRegisteredObject() * @api Smarty::getRegisteredObject()
* @link http://www.smarty.net/docs/en/api.get.registered.object.tpl * @link https://www.smarty.net/docs/en/api.get.registered.object.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $object_name object name * @param string $object_name object name

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_GetTags
* Return array of tag/attributes of all tags used by an template * Return array of tag/attributes of all tags used by an template
* *
* @api Smarty::getTags() * @api Smarty::getTags()
* @link http://www.smarty.net/docs/en/api.get.tags.tpl * @link https://www.smarty.net/docs/en/api.get.tags.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param null|string|Smarty_Internal_Template $template * @param null|string|Smarty_Internal_Template $template

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_GetTemplateVars
* Returns a single or all template variables * Returns a single or all template variables
* *
* @api Smarty::getTemplateVars() * @api Smarty::getTemplateVars()
* @link http://www.smarty.net/docs/en/api.get.template.vars.tpl * @link https://www.smarty.net/docs/en/api.get.template.vars.tpl
* *
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data * @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $data
* @param string $varName variable name or null * @param string $varName variable name or null

View File

@@ -30,7 +30,7 @@ class Smarty_Internal_Method_LoadFilter
* *
* @api Smarty::loadFilter() * @api Smarty::loadFilter()
* *
* @link http://www.smarty.net/docs/en/api.load.filter.tpl * @link https://www.smarty.net/docs/en/api.load.filter.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type filter type * @param string $type filter type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_RegisterCacheResource
* Registers a resource to fetch a template * Registers a resource to fetch a template
* *
* @api Smarty::registerCacheResource() * @api Smarty::registerCacheResource()
* @link http://www.smarty.net/docs/en/api.register.cacheresource.tpl * @link https://www.smarty.net/docs/en/api.register.cacheresource.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $name name of resource type * @param string $name name of resource type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_RegisterClass
* Registers static classes to be used in templates * Registers static classes to be used in templates
* *
* @api Smarty::registerClass() * @api Smarty::registerClass()
* @link http://www.smarty.net/docs/en/api.register.class.tpl * @link https://www.smarty.net/docs/en/api.register.class.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $class_name * @param string $class_name

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_RegisterDefaultPluginHandler
* Registers a default plugin handler * Registers a default plugin handler
* *
* @api Smarty::registerDefaultPluginHandler() * @api Smarty::registerDefaultPluginHandler()
* @link http://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl * @link https://www.smarty.net/docs/en/api.register.default.plugin.handler.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param callable $callback class/method name * @param callable $callback class/method name

View File

@@ -30,7 +30,7 @@ class Smarty_Internal_Method_RegisterFilter
* *
* @api Smarty::registerFilter() * @api Smarty::registerFilter()
* *
* @link http://www.smarty.net/docs/en/api.register.filter.tpl * @link https://www.smarty.net/docs/en/api.register.filter.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type filter type * @param string $type filter type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_RegisterObject
* Registers object to be used in templates * Registers object to be used in templates
* *
* @api Smarty::registerObject() * @api Smarty::registerObject()
* @link http://www.smarty.net/docs/en/api.register.object.tpl * @link https://www.smarty.net/docs/en/api.register.object.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $object_name * @param string $object_name

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_RegisterPlugin
* Registers plugin to be used in templates * Registers plugin to be used in templates
* *
* @api Smarty::registerPlugin() * @api Smarty::registerPlugin()
* @link http://www.smarty.net/docs/en/api.register.plugin.tpl * @link https://www.smarty.net/docs/en/api.register.plugin.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type plugin type * @param string $type plugin type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_RegisterResource
* Registers a resource to fetch a template * Registers a resource to fetch a template
* *
* @api Smarty::registerResource() * @api Smarty::registerResource()
* @link http://www.smarty.net/docs/en/api.register.resource.tpl * @link https://www.smarty.net/docs/en/api.register.resource.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $name name of resource type * @param string $name name of resource type

View File

@@ -16,7 +16,7 @@ class Smarty_Internal_Method_UnloadFilter extends Smarty_Internal_Method_LoadFil
* *
* @api Smarty::unloadFilter() * @api Smarty::unloadFilter()
* *
* @link http://www.smarty.net/docs/en/api.unload.filter.tpl * @link https://www.smarty.net/docs/en/api.unload.filter.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type filter type * @param string $type filter type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_UnregisterCacheResource
* Registers a resource to fetch a template * Registers a resource to fetch a template
* *
* @api Smarty::unregisterCacheResource() * @api Smarty::unregisterCacheResource()
* @link http://www.smarty.net/docs/en/api.unregister.cacheresource.tpl * @link https://www.smarty.net/docs/en/api.unregister.cacheresource.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param $name * @param $name

View File

@@ -16,7 +16,7 @@ class Smarty_Internal_Method_UnregisterFilter extends Smarty_Internal_Method_Reg
* *
* @api Smarty::unregisterFilter() * @api Smarty::unregisterFilter()
* *
* @link http://www.smarty.net/docs/en/api.unregister.filter.tpl * @link https://www.smarty.net/docs/en/api.unregister.filter.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type filter type * @param string $type filter type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_UnregisterObject
* Registers plugin to be used in templates * Registers plugin to be used in templates
* *
* @api Smarty::unregisterObject() * @api Smarty::unregisterObject()
* @link http://www.smarty.net/docs/en/api.unregister.object.tpl * @link https://www.smarty.net/docs/en/api.unregister.object.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $object_name name of object * @param string $object_name name of object

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_UnregisterPlugin
* Registers plugin to be used in templates * Registers plugin to be used in templates
* *
* @api Smarty::unregisterPlugin() * @api Smarty::unregisterPlugin()
* @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl * @link https://www.smarty.net/docs/en/api.unregister.plugin.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type plugin type * @param string $type plugin type

View File

@@ -22,7 +22,7 @@ class Smarty_Internal_Method_UnregisterResource
* Registers a resource to fetch a template * Registers a resource to fetch a template
* *
* @api Smarty::unregisterResource() * @api Smarty::unregisterResource()
* @link http://www.smarty.net/docs/en/api.unregister.resource.tpl * @link https://www.smarty.net/docs/en/api.unregister.resource.tpl
* *
* @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
* @param string $type name of resource type * @param string $type name of resource type

View File

@@ -87,83 +87,83 @@ class Smarty_Internal_ParseTree_Template extends Smarty_Internal_ParseTree
$code = ''; $code = '';
foreach ($this->getChunkedSubtrees() as $chunk) { foreach ($this->getChunkedSubtrees() as $chunk) {
$text = ''; $text = '';
switch ($chunk['mode']) { switch ($chunk['mode']) {
case 'textstripped': case 'textstripped':
foreach ($chunk['subtrees'] as $subtree) { foreach ($chunk['subtrees'] as $subtree) {
$text .= $subtree->to_smarty_php($parser); $text .= $subtree->to_smarty_php($parser);
} }
$code .= preg_replace( $code .= preg_replace(
'/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
"<?php echo '\$1'; ?>\n", "<?php echo '\$1'; ?>\n",
$parser->compiler->processText($text) $parser->compiler->processText($text)
); );
break; break;
case 'text': case 'text':
foreach ($chunk['subtrees'] as $subtree) { foreach ($chunk['subtrees'] as $subtree) {
$text .= $subtree->to_smarty_php($parser); $text .= $subtree->to_smarty_php($parser);
} }
$code .= preg_replace( $code .= preg_replace(
'/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/', '/((<%)|(%>)|(<\?php)|(<\?)|(\?>)|(<\/?script))/',
"<?php echo '\$1'; ?>\n", "<?php echo '\$1'; ?>\n",
$text $text
); );
break; break;
case 'tag': case 'tag':
foreach ($chunk['subtrees'] as $subtree) { foreach ($chunk['subtrees'] as $subtree) {
$text = $parser->compiler->appendCode($text, $subtree->to_smarty_php($parser)); $text = $parser->compiler->appendCode($text, $subtree->to_smarty_php($parser));
} }
$code .= $text; $code .= $text;
break; break;
default: default:
foreach ($chunk['subtrees'] as $subtree) { foreach ($chunk['subtrees'] as $subtree) {
$text = $subtree->to_smarty_php($parser); $text = $subtree->to_smarty_php($parser);
} }
$code .= $text; $code .= $text;
} }
} }
return $code; return $code;
} }
private function getChunkedSubtrees() { private function getChunkedSubtrees() {
$chunks = array(); $chunks = array();
$currentMode = null; $currentMode = null;
$currentChunk = array(); $currentChunk = array();
for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) { for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
if ($this->subtrees[ $key ]->data === '' && in_array($currentMode, array('textstripped', 'text', 'tag'))) { if ($this->subtrees[ $key ]->data === '' && in_array($currentMode, array('textstripped', 'text', 'tag'))) {
continue; continue;
} }
if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text if ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text
&& $this->subtrees[ $key ]->isToBeStripped()) { && $this->subtrees[ $key ]->isToBeStripped()) {
$newMode = 'textstripped'; $newMode = 'textstripped';
} elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) { } elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Text) {
$newMode = 'text'; $newMode = 'text';
} elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) { } elseif ($this->subtrees[ $key ] instanceof Smarty_Internal_ParseTree_Tag) {
$newMode = 'tag'; $newMode = 'tag';
} else { } else {
$newMode = 'other'; $newMode = 'other';
} }
if ($newMode == $currentMode) { if ($newMode == $currentMode) {
$currentChunk[] = $this->subtrees[ $key ]; $currentChunk[] = $this->subtrees[ $key ];
} else { } else {
$chunks[] = array( $chunks[] = array(
'mode' => $currentMode, 'mode' => $currentMode,
'subtrees' => $currentChunk 'subtrees' => $currentChunk
); );
$currentMode = $newMode; $currentMode = $newMode;
$currentChunk = array($this->subtrees[ $key ]); $currentChunk = array($this->subtrees[ $key ]);
} }
} }
if ($currentMode && $currentChunk) { if ($currentMode && $currentChunk) {
$chunks[] = array( $chunks[] = array(
'mode' => $currentMode, 'mode' => $currentMode,
'subtrees' => $currentChunk 'subtrees' => $currentChunk
); );
} }
return $chunks; return $chunks;
} }
} }

View File

@@ -17,30 +17,30 @@
class Smarty_Internal_ParseTree_Text extends Smarty_Internal_ParseTree class Smarty_Internal_ParseTree_Text extends Smarty_Internal_ParseTree
{ {
/** /**
* Wether this section should be stripped on output to smarty php * Wether this section should be stripped on output to smarty php
* @var bool * @var bool
*/ */
private $toBeStripped = false; private $toBeStripped = false;
/** /**
* Create template text buffer * Create template text buffer
* *
* @param string $data text * @param string $data text
* @param bool $toBeStripped wether this section should be stripped on output to smarty php * @param bool $toBeStripped wether this section should be stripped on output to smarty php
*/ */
public function __construct($data, $toBeStripped = false) public function __construct($data, $toBeStripped = false)
{ {
$this->data = $data; $this->data = $data;
$this->toBeStripped = $toBeStripped; $this->toBeStripped = $toBeStripped;
} }
/** /**
* Wether this section should be stripped on output to smarty php * Wether this section should be stripped on output to smarty php
* @return bool * @return bool
*/ */
public function isToBeStripped() { public function isToBeStripped() {
return $this->toBeStripped; return $this->toBeStripped;
} }
/** /**

View File

@@ -13,7 +13,7 @@
* Smarty Internal Plugin Resource Stream * Smarty Internal Plugin Resource Stream
* Implements the streams as resource for Smarty template * Implements the streams as resource for Smarty template
* *
* @link http://php.net/streams * @link https://php.net/streams
* @package Smarty * @package Smarty
* @subpackage TemplateResources * @subpackage TemplateResources
*/ */

View File

@@ -138,7 +138,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* test if cache is valid * test if cache is valid
* *
* @api Smarty::isCached() * @api Smarty::isCached()
* @link http://www.smarty.net/docs/en/api.is.cached.tpl * @link https://www.smarty.net/docs/en/api.is.cached.tpl
* *
* @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template * @param null|string|\Smarty_Internal_Template $template the resource handle of the template file or template
* object * object
@@ -201,8 +201,8 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) : null; isset($smarty->error_reporting) ? error_reporting($smarty->error_reporting) : null;
if ($smarty->getPHP7CompatMode()) { if ($smarty->getPHP7CompatMode()) {
$errorHandler = new Smarty_Internal_ErrorHandler(); $errorHandler = new Smarty_Internal_ErrorHandler();
$errorHandler->activate(); $errorHandler->activate();
} }
if ($this->_objType === 2) { if ($this->_objType === 2) {
@@ -250,7 +250,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
} }
if (isset($errorHandler)) { if (isset($errorHandler)) {
$errorHandler->deactivate(); $errorHandler->deactivate();
} }
if (isset($_smarty_old_error_level)) { if (isset($_smarty_old_error_level)) {
@@ -261,13 +261,13 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
while (ob_get_level() > $level) { while (ob_get_level() > $level) {
ob_end_clean(); ob_end_clean();
} }
if (isset($errorHandler)) { if (isset($errorHandler)) {
$errorHandler->deactivate(); $errorHandler->deactivate();
} }
if (isset($_smarty_old_error_level)) { if (isset($_smarty_old_error_level)) {
error_reporting($_smarty_old_error_level); error_reporting($_smarty_old_error_level);
} }
throw $e; throw $e;
} }
} }
@@ -276,7 +276,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* Registers plugin to be used in templates * Registers plugin to be used in templates
* *
* @api Smarty::registerPlugin() * @api Smarty::registerPlugin()
* @link http://www.smarty.net/docs/en/api.register.plugin.tpl * @link https://www.smarty.net/docs/en/api.register.plugin.tpl
* *
* @param string $type plugin type * @param string $type plugin type
* @param string $name name of template tag * @param string $name name of template tag
@@ -296,7 +296,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* load a filter of specified type and name * load a filter of specified type and name
* *
* @api Smarty::loadFilter() * @api Smarty::loadFilter()
* @link http://www.smarty.net/docs/en/api.load.filter.tpl * @link https://www.smarty.net/docs/en/api.load.filter.tpl
* *
* @param string $type filter type * @param string $type filter type
* @param string $name filter name * @param string $name filter name
@@ -313,7 +313,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* Registers a filter function * Registers a filter function
* *
* @api Smarty::registerFilter() * @api Smarty::registerFilter()
* @link http://www.smarty.net/docs/en/api.register.filter.tpl * @link https://www.smarty.net/docs/en/api.register.filter.tpl
* *
* @param string $type filter type * @param string $type filter type
* @param callable $callback * @param callable $callback
@@ -331,7 +331,7 @@ abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data
* Registers object to be used in templates * Registers object to be used in templates
* *
* @api Smarty::registerObject() * @api Smarty::registerObject()
* @link http://www.smarty.net/docs/en/api.register.object.tpl * @link https://www.smarty.net/docs/en/api.register.object.tpl
* *
* @param string $object_name * @param string $object_name
* @param object $object the referenced PHP object to register * @param object $object the referenced PHP object to register

View File

@@ -615,11 +615,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
$this->trigger_template_error('Illegal number of parameter in "isset()"'); $this->trigger_template_error('Illegal number of parameter in "isset()"');
} }
$pa = array(); $pa = array();
foreach ($parameter as $p) { foreach ($parameter as $p) {
$pa[] = $this->syntaxMatchesVariable($p) ? 'isset(' . $p . ')' : '(' . $p . ' !== null )'; $pa[] = $this->syntaxMatchesVariable($p) ? 'isset(' . $p . ')' : '(' . $p . ' !== null )';
} }
return '(' . implode(' && ', $pa) . ')'; return '(' . implode(' && ', $pa) . ')';
} elseif (in_array( } elseif (in_array(
$func_name, $func_name,
@@ -651,16 +651,16 @@ abstract class Smarty_Internal_TemplateCompilerBase
} }
} }
/** /**
* Determines whether the passed string represents a valid (PHP) variable. * Determines whether the passed string represents a valid (PHP) variable.
* This is important, because `isset()` only works on variables and `empty()` can only be passed * This is important, because `isset()` only works on variables and `empty()` can only be passed
* a variable prior to php5.5 * a variable prior to php5.5
* @param $string * @param $string
* @return bool * @return bool
*/ */
private function syntaxMatchesVariable($string) { private function syntaxMatchesVariable($string) {
static $regex_pattern = '/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*((->)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\[.*]*\])*$/'; static $regex_pattern = '/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*((->)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*|\[.*]*\])*$/';
return 1 === preg_match($regex_pattern, trim($string)); return 1 === preg_match($regex_pattern, trim($string));
} }
/** /**
@@ -675,11 +675,11 @@ abstract class Smarty_Internal_TemplateCompilerBase
{ {
if (strpos($text, '<') === false) { if (strpos($text, '<') === false) {
return preg_replace($this->stripRegEx, '', $text); return preg_replace($this->stripRegEx, '', $text);
} }
$store = array(); $store = array();
$_store = 0; $_store = 0;
// capture html elements not to be messed with // capture html elements not to be messed with
$_offset = 0; $_offset = 0;

View File

@@ -32,8 +32,8 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
*/ */
public function testUnknownConfigFile() public function testUnknownConfigFile()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('Unable to load config \'file:foo.conf\''); $this->expectExceptionMessage('Unable to load config \'file:foo.conf\'');
$this->smarty->configLoad('foo.conf'); $this->smarty->configLoad('foo.conf');
} }
@@ -42,9 +42,9 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
*/ */
public function testRegisterUnknownDefaultConfigHandler() public function testRegisterUnknownDefaultConfigHandler()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('Default config handler'); $this->expectExceptionMessage('Default config handler');
$this->expectExceptionMessage('not callable'); $this->expectExceptionMessage('not callable');
$this->smarty->registerDefaultConfigHandler('foo'); $this->smarty->registerDefaultConfigHandler('foo');
} }
@@ -76,8 +76,8 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
public function testDefaultConfigHandlerReplacementByConfigFileFail() public function testDefaultConfigHandlerReplacementByConfigFileFail()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage("Unable to load config default file 'no.conf' for 'file:fo.conf'"); $this->expectExceptionMessage("Unable to load config default file 'no.conf' for 'file:fo.conf'");
$this->smarty->registerDefaultConfigHandler('configHandlerFile'); $this->smarty->registerDefaultConfigHandler('configHandlerFile');
$this->smarty->configLoad('fo.conf'); $this->smarty->configLoad('fo.conf');
$this->assertEquals("123.4", $this->smarty->fetch('number.tpl')); $this->assertEquals("123.4", $this->smarty->fetch('number.tpl'));
@@ -88,8 +88,8 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
*/ */
public function testDefaultConfigHandlerReplacementReturningFalse() public function testDefaultConfigHandlerReplacementReturningFalse()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('Unable to load config \'file:foo.conf\''); $this->expectExceptionMessage('Unable to load config \'file:foo.conf\'');
$this->smarty->configLoad('foo.conf'); $this->smarty->configLoad('foo.conf');
} }
@@ -98,8 +98,8 @@ class DefaultConfigHandlerTest extends PHPUnit_Smarty
*/ */
public function testDefaultConfigHandlerReplacementReturningFalse1() public function testDefaultConfigHandlerReplacementReturningFalse1()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('No config default content for \'file:bla.conf\''); $this->expectExceptionMessage('No config default content for \'file:bla.conf\'');
$this->smarty->registerDefaultConfigHandler('configHandlerData'); $this->smarty->registerDefaultConfigHandler('configHandlerData');
$this->smarty->configLoad('bla.conf'); $this->smarty->configLoad('bla.conf');
} }

View File

@@ -403,7 +403,7 @@ class ConfigVarTest extends PHPUnit_Smarty
$this->assertEquals("", $this->smarty->fetch('foo.tpl')); $this->assertEquals("", $this->smarty->fetch('foo.tpl'));
} }
catch (Exception $e) { catch (Exception $e) {
$this->assertStringStartsWith('Undefined variable', $e->getMessage()); $this->assertStringStartsWith('Undefined variable', $e->getMessage());
} }
} }
} }

View File

@@ -143,8 +143,8 @@ if (MysqlResourceEnable == true) {
* *
*/ */
public function testUnknownTemplate() { public function testUnknownTemplate() {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('Unable to load template \'mysqlstest:foo.tpl\''); $this->expectExceptionMessage('Unable to load template \'mysqlstest:foo.tpl\'');
$this->assertEquals('foo', $this->smarty->fetch('mysqlstest:foo.tpl')); $this->assertEquals('foo', $this->smarty->fetch('mysqlstest:foo.tpl'));
} }
} }

View File

@@ -69,10 +69,10 @@ class FileResourceTest extends PHPUnit_Smarty
*/ */
public function testTemplateFileNotExists3() public function testTemplateFileNotExists3()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('Unable to'); $this->expectExceptionMessage('Unable to');
$this->expectExceptionMessage('notthere.tpl'); $this->expectExceptionMessage('notthere.tpl');
$this->smarty->fetch('notthere.tpl'); $this->smarty->fetch('notthere.tpl');
} }
public function testGetTemplateTimestamp() public function testGetTemplateTimestamp()
@@ -108,9 +108,9 @@ class FileResourceTest extends PHPUnit_Smarty
); );
} }
/** /**
* @doesNotPerformAssertions * @doesNotPerformAssertions
*/ */
public function testGetCompiledTimestampPrepare() public function testGetCompiledTimestampPrepare()
{ {
$tpl = $this->smarty->createTemplate('helloworld.tpl'); $tpl = $this->smarty->createTemplate('helloworld.tpl');
@@ -143,9 +143,9 @@ class FileResourceTest extends PHPUnit_Smarty
$this->assertTrue($tpl->mustCompile()); $this->assertTrue($tpl->mustCompile());
} }
/** /**
* @doesNotPerformAssertions * @doesNotPerformAssertions
*/ */
public function testMustCompileTouchedSourcePrepare() public function testMustCompileTouchedSourcePrepare()
{ {
// touch to prepare next test // touch to prepare next test
@@ -222,8 +222,8 @@ class FileResourceTest extends PHPUnit_Smarty
*/ */
public function testRelativeIncludeFail() public function testRelativeIncludeFail()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('Unable to'); $this->expectExceptionMessage('Unable to');
$this->smarty->fetch('relative_sub.tpl'); $this->smarty->fetch('relative_sub.tpl');
} }
/** /**
@@ -234,8 +234,8 @@ class FileResourceTest extends PHPUnit_Smarty
*/ */
public function testRelativeIncludeFailOtherDir() public function testRelativeIncludeFailOtherDir()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('./hello.tpl'); $this->expectExceptionMessage('./hello.tpl');
$this->smarty->addTemplateDir('./templates_2'); $this->smarty->addTemplateDir('./templates_2');
$this->smarty->fetch('relative_notexist.tpl'); $this->smarty->fetch('relative_notexist.tpl');
} }

View File

@@ -84,48 +84,48 @@ class RegisteredResourceTest extends PHPUnit_Smarty
class RegisteredResourceTest_Resource1 extends Smarty_Resource_Custom { class RegisteredResourceTest_Resource1 extends Smarty_Resource_Custom {
protected function fetch($name, &$source, &$mtime) { protected function fetch($name, &$source, &$mtime) {
$source = '{$x="hello world"}{$x}'; $source = '{$x="hello world"}{$x}';
$mtime = 1000000000; $mtime = 1000000000;
} }
} }
class RegisteredResourceTest_Resource2 extends Smarty_Resource_Custom { class RegisteredResourceTest_Resource2 extends Smarty_Resource_Custom {
protected function fetch($name, &$source, &$mtime) { protected function fetch($name, &$source, &$mtime) {
// we update a counter, so that we return a new source for every call // we update a counter, so that we return a new source for every call
static $counter = 0; static $counter = 0;
$counter ++; $counter ++;
// construct a new source // construct a new source
$source = "this is template $counter"; $source = "this is template $counter";
$mtime = 1000000000; $mtime = 1000000000;
} }
protected function fetchTimestamp($name) protected function fetchTimestamp($name)
{ {
return 1000000000; return 1000000000;
} }
} }
class RegisteredResourceTest_Resource3 extends Smarty_Resource_Custom { class RegisteredResourceTest_Resource3 extends Smarty_Resource_Custom {
protected function fetch($name, &$source, &$mtime) { protected function fetch($name, &$source, &$mtime) {
$source = 'template = {$smarty.template}'; $source = 'template = {$smarty.template}';
$mtime = 1000000000; $mtime = 1000000000;
} }
} }
class RegisteredResourceTest_Resource4 extends Smarty_Resource_Custom { class RegisteredResourceTest_Resource4 extends Smarty_Resource_Custom {
protected function fetch($name, &$source, &$mtime) { protected function fetch($name, &$source, &$mtime) {
$source = 'current_dir = {$smarty.current_dir}'; $source = 'current_dir = {$smarty.current_dir}';
$mtime = 1000000000; $mtime = 1000000000;
} }
} }

View File

@@ -12,14 +12,14 @@
class Smarty_Resource_Db extends Smarty_Resource_Recompiled { class Smarty_Resource_Db extends Smarty_Resource_Recompiled {
public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) { public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null) {
$source->filepath = 'db:'; $source->filepath = 'db:';
$source->uid = sha1($source->resource); $source->uid = sha1($source->resource);
$source->timestamp = 1000000000; $source->timestamp = 1000000000;
$source->exists = true; $source->exists = true;
} }
public function getContent(Smarty_Template_Source $source) { public function getContent(Smarty_Template_Source $source) {
return '{$x="hello world"}{$x}'; return '{$x="hello world"}{$x}';
} }
} }

View File

@@ -146,8 +146,8 @@ class StreamResourceTest extends PHPUnit_Smarty
public function testTemplateStramNotExists3() public function testTemplateStramNotExists3()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('\'global:notthere\''); $this->expectExceptionMessage('\'global:notthere\'');
$this->smarty->fetch('global:notthere'); $this->smarty->fetch('global:notthere');
} }

View File

@@ -62,8 +62,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotTrustedPHPFunction() public function testNotTrustedPHPFunction()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('PHP function \'count\' not allowed by security setting'); $this->expectExceptionMessage('PHP function \'count\' not allowed by security setting');
$this->smarty->security_policy->php_functions = array('null'); $this->smarty->security_policy->php_functions = array('null');
$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{count($foo)}'); $this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{count($foo)}');
} }
@@ -93,8 +93,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotTrustedModifier() public function testNotTrustedModifier()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('modifier \'count\' not allowed by security setting'); $this->expectExceptionMessage('modifier \'count\' not allowed by security setting');
$this->smarty->security_policy->php_modifiers = array('null'); $this->smarty->security_policy->php_modifiers = array('null');
$this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{$foo|@count}'); $this->smarty->fetch('string:{assign var=foo value=[1,2,3,4,5]}{$foo|@count}');
} }
@@ -125,8 +125,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotAllowedTags2() public function testNotAllowedTags2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('tag \'cycle\' not allowed by security setting'); $this->expectExceptionMessage('tag \'cycle\' not allowed by security setting');
$this->smarty->security_policy->allowed_tags = array('counter'); $this->smarty->security_policy->allowed_tags = array('counter');
$this->smarty->fetch('string:{counter}{cycle values="1,2"}'); $this->smarty->fetch('string:{counter}{cycle values="1,2"}');
} }
@@ -138,8 +138,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testDisabledTags() public function testDisabledTags()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('tag \'cycle\' disabled by security setting'); $this->expectExceptionMessage('tag \'cycle\' disabled by security setting');
$this->smarty->security_policy->disabled_tags = array('cycle'); $this->smarty->security_policy->disabled_tags = array('cycle');
$this->smarty->fetch('string:{counter}{cycle values="1,2"}'); $this->smarty->fetch('string:{counter}{cycle values="1,2"}');
} }
@@ -168,8 +168,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotAllowedModifier() public function testNotAllowedModifier()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('modifier \'lower\' not allowed by security setting'); $this->expectExceptionMessage('modifier \'lower\' not allowed by security setting');
$this->smarty->security_policy->allowed_modifiers = array('upper'); $this->smarty->security_policy->allowed_modifiers = array('upper');
$this->smarty->fetch('string:{"hello"|upper}{"world"|lower}'); $this->smarty->fetch('string:{"hello"|upper}{"world"|lower}');
} }
@@ -181,8 +181,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testDisabledModifier() public function testDisabledModifier()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('modifier \'lower\' disabled by security setting'); $this->expectExceptionMessage('modifier \'lower\' disabled by security setting');
$this->smarty->security_policy->disabled_modifiers = array('lower'); $this->smarty->security_policy->disabled_modifiers = array('lower');
$this->smarty->fetch('string:{"hello"|upper}{"world"|lower}'); $this->smarty->fetch('string:{"hello"|upper}{"world"|lower}');
} }
@@ -196,15 +196,15 @@ class SecurityTest extends PHPUnit_Smarty
$this->assertEquals('<?php echo "hello world"; ?>', $this->smarty->fetch('string:<?php echo "hello world"; ?>')); $this->assertEquals('<?php echo "hello world"; ?>', $this->smarty->fetch('string:<?php echo "hello world"; ?>'));
} }
public function testSmartyPhpAllow2() public function testSmartyPhpAllow2()
{ {
$this->assertEquals('<? echo "hello world"; ?>', $this->smarty->fetch('string:<? echo "hello world"; ?>')); $this->assertEquals('<? echo "hello world"; ?>', $this->smarty->fetch('string:<? echo "hello world"; ?>'));
} }
public function testSmartyPhpAllow3() public function testSmartyPhpAllow3()
{ {
$this->assertEquals('<% echo "hello world"; %>', $this->smarty->fetch('string:<% echo "hello world"; %>')); $this->assertEquals('<% echo "hello world"; %>', $this->smarty->fetch('string:<% echo "hello world"; %>'));
} }
/** /**
* test standard directory * test standard directory
@@ -232,8 +232,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotTrustedDirectory() public function testNotTrustedDirectory()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('not trusted file path'); $this->expectExceptionMessage('not trusted file path');
$this->smarty->security_policy->secure_dir = array(str_replace('\\', '/', dirname(__FILE__) . '/templates_3/')); $this->smarty->security_policy->secure_dir = array(str_replace('\\', '/', dirname(__FILE__) . '/templates_3/'));
$this->smarty->fetch('string:{include file="templates_2/hello.tpl"}'); $this->smarty->fetch('string:{include file="templates_2/hello.tpl"}');
} }
@@ -264,8 +264,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotTrustedStaticClass() public function testNotTrustedStaticClass()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('access to static class \'mysecuritystaticclass\' not allowed by security setting'); $this->expectExceptionMessage('access to static class \'mysecuritystaticclass\' not allowed by security setting');
$this->smarty->security_policy->static_classes = array('null'); $this->smarty->security_policy->static_classes = array('null');
$this->smarty->fetch('string:{mysecuritystaticclass::square(5)}'); $this->smarty->fetch('string:{mysecuritystaticclass::square(5)}');
} }
@@ -307,8 +307,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testTemplateNotTrustedStream() public function testTemplateNotTrustedStream()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('stream \'global\' not allowed by security setting'); $this->expectExceptionMessage('stream \'global\' not allowed by security setting');
stream_wrapper_register("global", "ResourceStreamSecurity") stream_wrapper_register("global", "ResourceStreamSecurity")
or die("Failed to register protocol"); or die("Failed to register protocol");
$fp = fopen("global://mytest", "r+"); $fp = fopen("global://mytest", "r+");
@@ -336,8 +336,8 @@ class SecurityTest extends PHPUnit_Smarty
*/ */
public function testNotTrustedUri() public function testNotTrustedUri()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('URI \'https://www.smarty.net/docs/en/preface.tpl\' not allowed by security setting'); $this->expectExceptionMessage('URI \'https://www.smarty.net/docs/en/preface.tpl\' not allowed by security setting');
$this->smarty->security_policy->trusted_uri = array(); $this->smarty->security_policy->trusted_uri = array();
$this->assertStringContainsString('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}')); $this->assertStringContainsString('<title>Preface | Smarty</title>', $this->smarty->fetch('string:{fetch file="https://www.smarty.net/docs/en/preface.tpl"}'));
} }

View File

@@ -50,8 +50,8 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
*/ */
public function testBlockPluginUnknown() public function testBlockPluginUnknown()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('unknown tag \'bar\''); $this->expectExceptionMessage('unknown tag \'bar\'');
$this->assertEquals("hello world", $this->smarty->fetch('unknown.tpl')); $this->assertEquals("hello world", $this->smarty->fetch('unknown.tpl'));
} }
@@ -76,8 +76,8 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
*/ */
public function testBlockPluginRegisteredFunction2() public function testBlockPluginRegisteredFunction2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('block tag \'blockplugintest\' not callable'); $this->expectExceptionMessage('block tag \'blockplugintest\' not callable');
$this->assertEquals('block test', $this->smarty->fetch('registered.tpl')); $this->assertEquals('block test', $this->smarty->fetch('registered.tpl'));
} }
@@ -103,8 +103,8 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
*/ */
public function testBlockPluginRegisteredStatic2() public function testBlockPluginRegisteredStatic2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('block tag \'blockpluginstatic\' not callable'); $this->expectExceptionMessage('block tag \'blockpluginstatic\' not callable');
$this->assertEquals('static block test', $this->smarty->fetch('registered_static.tpl')); $this->assertEquals('static block test', $this->smarty->fetch('registered_static.tpl'));
} }
@@ -130,8 +130,8 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
*/ */
public function testBlockPluginRegisteredMethod2() public function testBlockPluginRegisteredMethod2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('block tag \'blockpluginmethod\' not callable'); $this->expectExceptionMessage('block tag \'blockpluginmethod\' not callable');
$this->assertEquals('method block test', $this->smarty->fetch('registered_method.tpl')); $this->assertEquals('method block test', $this->smarty->fetch('registered_method.tpl'));
} }
@@ -157,8 +157,8 @@ class CompileBlockPluginTest extends PHPUnit_Smarty
*/ */
public function testBlockPluginRegisteredObject2() public function testBlockPluginRegisteredObject2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('block tag \'myobject\' not callable'); $this->expectExceptionMessage('block tag \'myobject\' not callable');
$this->assertEquals('object block test', $this->smarty->fetch('registered_object.tpl')); $this->assertEquals('object block test', $this->smarty->fetch('registered_object.tpl'));
} }

View File

@@ -755,8 +755,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyBlockChildOutsideBlock_025() public function testSmartyBlockChildOutsideBlock_025()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('\'{$smarty.block.child}\' used outside {block} tags'); $this->expectExceptionMessage('\'{$smarty.block.child}\' used outside {block} tags');
$this->smarty->fetch('025_parent.tpl'); $this->smarty->fetch('025_parent.tpl');
} }
@@ -765,8 +765,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyBlockParentOutsideBlock_026() public function testSmartyBlockParentOutsideBlock_026()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('\'{$smarty.block.parent}\' used outside {block} tags'); $this->expectExceptionMessage('\'{$smarty.block.parent}\' used outside {block} tags');
$this->smarty->fetch('026_child.tpl'); $this->smarty->fetch('026_child.tpl');
} }
@@ -775,8 +775,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyBlockParentInParent_027() public function testSmartyBlockParentInParent_027()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('illegal \'{$smarty.block.parent}\''); $this->expectExceptionMessage('illegal \'{$smarty.block.parent}\'');
$this->smarty->fetch('027_parent.tpl'); $this->smarty->fetch('027_parent.tpl');
} }
@@ -1145,8 +1145,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyBlockWrongBlockName_036() public function testSmartyBlockWrongBlockName_036()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('$smarty.block is not defined'); $this->expectExceptionMessage('$smarty.block is not defined');
$this->smarty->fetch('036_parent.tpl'); $this->smarty->fetch('036_parent.tpl');
} }
/** /**
@@ -1154,8 +1154,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyParentBlockCalledInParent_036_1() public function testSmartyParentBlockCalledInParent_036_1()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('inheritance: illegal \'{$smarty.block.parent}\' used in child template'); $this->expectExceptionMessage('inheritance: illegal \'{$smarty.block.parent}\' used in child template');
$this->smarty->fetch('036_1_parent.tpl'); $this->smarty->fetch('036_1_parent.tpl');
} }
/** /**
@@ -1163,8 +1163,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyParentBlockCalledInParent_036_2() public function testSmartyParentBlockCalledInParent_036_2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('inheritance: illegal \'{block_parent}\' used in child template'); $this->expectExceptionMessage('inheritance: illegal \'{block_parent}\' used in child template');
$this->smarty->fetch('036_2_parent.tpl'); $this->smarty->fetch('036_2_parent.tpl');
} }
/** /**
@@ -1172,8 +1172,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyParentBlockCalledInParent_036_3() public function testSmartyParentBlockCalledInParent_036_3()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('inheritance: illegal \'{parent}\' used in child template'); $this->expectExceptionMessage('inheritance: illegal \'{parent}\' used in child template');
$this->smarty->fetch('036_3_parent.tpl'); $this->smarty->fetch('036_3_parent.tpl');
} }
@@ -1182,8 +1182,8 @@ class CompileBlockExtendsTest extends PHPUnit_Smarty
*/ */
public function testSmartyBlockMissigBlockName_037() public function testSmartyBlockMissigBlockName_037()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('$smarty.block is not defined'); $this->expectExceptionMessage('$smarty.block is not defined');
$this->smarty->fetch('037_parent.tpl'); $this->smarty->fetch('037_parent.tpl');
} }

View File

@@ -165,8 +165,8 @@ class CompileConfigLoadTest extends PHPUnit_Smarty
*/ */
public function testConfigSyntaxError_009() public function testConfigSyntaxError_009()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('Syntax error in config file'); $this->expectExceptionMessage('Syntax error in config file');
$this->smarty->fetch('009_error.tpl'); $this->smarty->fetch('009_error.tpl');
} }
} }

View File

@@ -43,8 +43,8 @@ class CompileDelimiterTest extends PHPUnit_Smarty
public function testLeftDelimiterError() public function testLeftDelimiterError()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('nocache option not allowed'); $this->expectExceptionMessage('nocache option not allowed');
$tpl = $this->smarty->createTemplate('string:x{ldelim nocache}x'); $tpl = $this->smarty->createTemplate('string:x{ldelim nocache}x');
$this->assertEquals('x{x', $this->smarty->fetch($tpl)); $this->assertEquals('x{x', $this->smarty->fetch($tpl));
} }

View File

@@ -94,9 +94,9 @@ class CompileForeachTest extends PHPUnit_Smarty
array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}{if $x@show}-show{else}-noshow{/if}', array(), 'else-noshow', '', $i ++), array('{foreach item=x from=$foo}{$x}{foreachelse}else{/foreach}{if $x@show}-show{else}-noshow{/if}', array(), 'else-noshow', '', $i ++),
array('{foreach $foo x y foo}{$y}.{$x},{foreachelse}else{/foreach}total{$smarty.foreach.foo.total}', array(9,10,11), '0.9,1.10,2.11,total3', '', $i ++), array('{foreach $foo x y foo}{$y}.{$x},{foreachelse}else{/foreach}total{$smarty.foreach.foo.total}', array(9,10,11), '0.9,1.10,2.11,total3', '', $i ++),
array('{$x = "hallo"}{$bar=[1,2,3]}{foreach $foo as $x}outer={$x@index}.{$x}#{foreach $bar as $x}inner={$x@index}.{$x}{/foreach}##{/foreach}###{$x}', array(9,10,11), 'outer=0.9#inner=0.1inner=1.2inner=2.3##outer=1.10#inner=0.1inner=1.2inner=2.3##outer=2.11#inner=0.1inner=1.2inner=2.3#####hallo', '', $i ++), array('{$x = "hallo"}{$bar=[1,2,3]}{foreach $foo as $x}outer={$x@index}.{$x}#{foreach $bar as $x}inner={$x@index}.{$x}{/foreach}##{/foreach}###{$x}', array(9,10,11), 'outer=0.9#inner=0.1inner=1.2inner=2.3##outer=1.10#inner=0.1inner=1.2inner=2.3##outer=2.11#inner=0.1inner=1.2inner=2.3#####hallo', '', $i ++),
array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', null, 'else', '', $i ++), array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', null, 'else', '', $i ++),
array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', array(), 'else', '', $i ++), array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', array(), 'else', '', $i ++),
array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', new \ArrayIterator(), 'else', '', $i ++), array('{foreach $foo as $x}{$x}{foreachelse}else{/foreach}', new \ArrayIterator(), 'else', '', $i ++),
); );
} }

View File

@@ -2,5 +2,5 @@
function smarty_insert_test2($params, $smarty) { function smarty_insert_test2($params, $smarty) {
return $smarty->tpl_vars[$params['var']]->value; return $smarty->tpl_vars[$params['var']]->value;
} }

View File

@@ -45,8 +45,8 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
*/ */
public function testFetchInvalidUri() public function testFetchInvalidUri()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('{fetch} cannot read resource \'https://foo.smarty.net/foo.dat\''); $this->expectExceptionMessage('{fetch} cannot read resource \'https://foo.smarty.net/foo.dat\'');
$this->smarty->fetch('string:{fetch file="https://foo.smarty.net/foo.dat"}'); $this->smarty->fetch('string:{fetch file="https://foo.smarty.net/foo.dat"}');
} }
@@ -58,8 +58,8 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
*/ */
public function testFetchSecurity() public function testFetchSecurity()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('not trusted file path'); $this->expectExceptionMessage('not trusted file path');
$this->cleanDirs(); $this->cleanDirs();
$dir=$this->smarty->getTemplateDir(); $dir=$this->smarty->getTemplateDir();
$this->smarty->enableSecurity(); $this->smarty->enableSecurity();
@@ -73,8 +73,8 @@ class PluginFunctionFetchTest extends PHPUnit_Smarty
*/ */
public function testFetchSecurity2() public function testFetchSecurity2()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('not trusted file path'); $this->expectExceptionMessage('not trusted file path');
$this->cleanDirs(); $this->cleanDirs();
$this->smarty->getTemplateDir(); $this->smarty->getTemplateDir();
$this->smarty->enableSecurity(); $this->smarty->enableSecurity();

View File

@@ -285,7 +285,7 @@ class PluginFunctionHtmlCheckboxesTest extends PHPUnit_Smarty
$this->_errors = array(); $this->_errors = array();
set_error_handler(array($this, 'error_handler')); set_error_handler(array($this, 'error_handler'));
$this->smarty->setPHP7CompatMode(); $this->smarty->setPHP7CompatMode();
$tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />"}'); $tpl = $this->smarty->createTemplate('eval:{html_checkboxes name="id" options=$cust_radios selected=$customer_id separator="<br />"}');
$tpl->assign('customer_id', new _object_noString(1001)); $tpl->assign('customer_id', new _object_noString(1001));
$tpl->assign('cust_radios', array( $tpl->assign('cust_radios', array(

View File

@@ -20,11 +20,11 @@ class PluginModifierDefaultTest extends PHPUnit_Smarty
$this->setUpSmarty(dirname(__FILE__)); $this->setUpSmarty(dirname(__FILE__));
} }
public function testDefault() public function testDefault()
{ {
$tpl = $this->smarty->createTemplate('string:{$array.a.b|default:$array.c:\'defaultval\'}'); $tpl = $this->smarty->createTemplate('string:{$array.a.b|default:$array.c:\'defaultval\'}');
$this->smarty->assign('array', []); $this->smarty->assign('array', []);
$this->assertEquals('defaultval', $this->smarty->fetch($tpl)); $this->assertEquals('defaultval', $this->smarty->fetch($tpl));
} }
} }

View File

@@ -32,8 +32,8 @@ class AttributeTest extends PHPUnit_Smarty
*/ */
public function testRequiredAttributeVar() public function testRequiredAttributeVar()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('missing \'var\' attribute'); $this->expectExceptionMessage('missing \'var\' attribute');
$this->smarty->fetch('string:{assign value=1}'); $this->smarty->fetch('string:{assign value=1}');
} }
@@ -42,8 +42,8 @@ class AttributeTest extends PHPUnit_Smarty
*/ */
public function testUnexpectedAttribute() public function testUnexpectedAttribute()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('unexpected \'bar\' attribute'); $this->expectExceptionMessage('unexpected \'bar\' attribute');
$this->smarty->fetch('string:{assign var=foo value=1 bar=2}'); $this->smarty->fetch('string:{assign var=foo value=1 bar=2}');
} }
@@ -52,9 +52,9 @@ class AttributeTest extends PHPUnit_Smarty
*/ */
public function testIllegalOptionValue() public function testIllegalOptionValue()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('for option flag \'nocache\''); $this->expectExceptionMessage('for option flag \'nocache\'');
$this->expectExceptionMessage('illegal value'); $this->expectExceptionMessage('illegal value');
$this->smarty->fetch('string:{assign var=foo value=1 nocache=buh}'); $this->smarty->fetch('string:{assign var=foo value=1 nocache=buh}');
} }
@@ -63,8 +63,8 @@ class AttributeTest extends PHPUnit_Smarty
*/ */
public function testTooManyShorthands() public function testTooManyShorthands()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('too many shorthand attributes'); $this->expectExceptionMessage('too many shorthand attributes');
$this->smarty->fetch('string:{assign foo 1 2}'); $this->smarty->fetch('string:{assign foo 1 2}');
} }

View File

@@ -30,8 +30,8 @@ class CompileErrorTest extends PHPUnit_Smarty
*/ */
public function testNoneExistingTemplateError() public function testNoneExistingTemplateError()
{ {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('no.tpl'); $this->expectExceptionMessage('no.tpl');
$this->smarty->fetch('eval:{include file=\'no.tpl\'}'); $this->smarty->fetch('eval:{include file=\'no.tpl\'}');
} }
@@ -40,8 +40,8 @@ class CompileErrorTest extends PHPUnit_Smarty
*/ */
public function testUnknownTagError() public function testUnknownTagError()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('unknown tag \'unknown\''); $this->expectExceptionMessage('unknown tag \'unknown\'');
$this->smarty->fetch('eval:{unknown}'); $this->smarty->fetch('eval:{unknown}');
} }
@@ -50,8 +50,8 @@ class CompileErrorTest extends PHPUnit_Smarty
*/ */
public function testUnclosedTagError() public function testUnclosedTagError()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('unclosed {if} tag'); $this->expectExceptionMessage('unclosed {if} tag');
$this->smarty->fetch('eval:{if true}'); $this->smarty->fetch('eval:{if true}');
} }
@@ -60,8 +60,8 @@ class CompileErrorTest extends PHPUnit_Smarty
*/ */
public function testSyntaxError() public function testSyntaxError()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('Unexpected "}"'); $this->expectExceptionMessage('Unexpected "}"');
$this->smarty->fetch('eval:{assign var=}'); $this->smarty->fetch('eval:{assign var=}');
} }
} }

View File

@@ -84,8 +84,8 @@ class DoubleQuotedStringTest extends PHPUnit_Smarty
*/ */
public function testDoubleQuotedUnclosedBlock_001() public function testDoubleQuotedUnclosedBlock_001()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('unclosed \'{if}\' in doubled quoted string'); $this->expectExceptionMessage('unclosed \'{if}\' in doubled quoted string');
$this->smarty->fetch('001_unclosedBlock.tpl'); $this->smarty->fetch('001_unclosedBlock.tpl');
} }

View File

@@ -100,8 +100,8 @@ class ModifierTest extends PHPUnit_Smarty
*/ */
public function testUnknownModifier() public function testUnknownModifier()
{ {
$this->expectException('SmartyCompilerException'); $this->expectException('SmartyCompilerException');
$this->expectExceptionMessage('unknown modifier \'unknown\''); $this->expectExceptionMessage('unknown modifier \'unknown\'');
$this->smarty->fetch('eval:{"hello world"|unknown}'); $this->smarty->fetch('eval:{"hello world"|unknown}');
} }

View File

@@ -146,56 +146,56 @@ class PhpFunctionTest extends PHPUnit_Smarty
')); '));
} }
/** /**
* test PHP isset() on (non-)variables * test PHP isset() on (non-)variables
* @dataProvider dataTestIsset3 * @dataProvider dataTestIsset3
* @param string $strTemplate template to test * @param string $strTemplate template to test
* @param string $result expected result * @param string $result expected result
*/ */
public function testIsset3($strTemplate, $result) public function testIsset3($strTemplate, $result)
{ {
$this->smarty->disableSecurity(); $this->smarty->disableSecurity();
$this->smarty->assign('varobject', new TestIsset()); $this->smarty->assign('varobject', new TestIsset());
$this->smarty->assign('vararray', $vararray = array( $this->smarty->assign('vararray', $vararray = array(
'keythatexists' => false, 'keythatexists' => false,
'keywitharray' => array(1 => 1), 'keywitharray' => array(1 => 1),
'keywithobject' => new TestIsset() 'keywithobject' => new TestIsset()
)); ));
$this->smarty->assign('key', 'A'); $this->smarty->assign('key', 'A');
$this->smarty->assign('_varsimpleA', 1); $this->smarty->assign('_varsimpleA', 1);
$this->smarty->assign('varsimpleB', 0); $this->smarty->assign('varsimpleB', 0);
$this->smarty->assign('varsimpleC', null); $this->smarty->assign('varsimpleC', null);
$this->assertEquals($result, $this->smarty->fetch('string:' . $strTemplate)); $this->assertEquals($result, $this->smarty->fetch('string:' . $strTemplate));
} }
/** /**
* Data provider for testIsset3 * Data provider for testIsset3
*/ */
public function dataTestIsset3() public function dataTestIsset3()
{ {
return array( return array(
array('{if isset($varobject->arr)}true{else}false{/if}', 'true'), array('{if isset($varobject->arr)}true{else}false{/if}', 'true'),
array('{if isset($vararray["keywitharray"])}true{else}false{/if}', 'true'), array('{if isset($vararray["keywitharray"])}true{else}false{/if}', 'true'),
array('{if isset($vararray["keythatexists"])}true{else}false{/if}', 'true'), array('{if isset($vararray["keythatexists"])}true{else}false{/if}', 'true'),
array('{if isset($vararray["nonexistingkey"])}true{else}false{/if}', 'false'), array('{if isset($vararray["nonexistingkey"])}true{else}false{/if}', 'false'),
array('{if isset($_GET["sscr6hr6cz34j6"])}true{else}false{/if}', 'false'), array('{if isset($_GET["sscr6hr6cz34j6"])}true{else}false{/if}', 'false'),
array('{if isset(count([\'hi\']))}true{else}false{/if}', 'true'), array('{if isset(count([\'hi\']))}true{else}false{/if}', 'true'),
array('{if isset($vararray[\'keywitharray\'][intval(\'1\')])}true{else}false{/if}', 'true'), array('{if isset($vararray[\'keywitharray\'][intval(\'1\')])}true{else}false{/if}', 'true'),
array('{if isset($vararray[\'keywithobject\']->arr[\'isSet\'])}true{else}false{/if}', 'true'), array('{if isset($vararray[\'keywithobject\']->arr[\'isSet\'])}true{else}false{/if}', 'true'),
array('{if isset($vararray[\'keywithobject\']->arr[\'isNull\'])}true{else}false{/if}', 'false'), array('{if isset($vararray[\'keywithobject\']->arr[\'isNull\'])}true{else}false{/if}', 'false'),
array('{if isset($varobject->arr[\'isSet\'])}true{else}false{/if}', 'true'), array('{if isset($varobject->arr[\'isSet\'])}true{else}false{/if}', 'true'),
array('{if isset($varobject->arr[\'isNull\'])}true{else}false{/if}', 'false'), array('{if isset($varobject->arr[\'isNull\'])}true{else}false{/if}', 'false'),
array('{if isset($_varsimpleA)}true{else}false{/if}', 'true'), array('{if isset($_varsimpleA)}true{else}false{/if}', 'true'),
array('{if isset($varsimpleB)}true{else}false{/if}', 'true'), array('{if isset($varsimpleB)}true{else}false{/if}', 'true'),
array('{if isset($varsimpleC)}true{else}false{/if}', 'false'), array('{if isset($varsimpleC)}true{else}false{/if}', 'false'),
array('{if isset($_varsimpleA && varsimpleB)}true{else}false{/if}', 'true'), array('{if isset($_varsimpleA && varsimpleB)}true{else}false{/if}', 'true'),
array('{if isset($_varsimpleA && varsimpleC)}true{else}false{/if}', 'true'), array('{if isset($_varsimpleA && varsimpleC)}true{else}false{/if}', 'true'),
array('{if isset($_varsimple{$key})}true{else}false{/if}', 'true'), array('{if isset($_varsimple{$key})}true{else}false{/if}', 'true'),
); );
} }
} }
/** /**

View File

@@ -28,8 +28,8 @@ class SmartyErrorTest extends PHPUnit_Smarty
* test undefined Smarty special variable * test undefined Smarty special variable
*/ */
public function testSmartyError() { public function testSmartyError() {
$this->expectException('SmartyException'); $this->expectException('SmartyException');
$this->expectExceptionMessage('$smarty.foo is not defined'); $this->expectExceptionMessage('$smarty.foo is not defined');
$this->assertEquals(Smarty::SMARTY_VERSION, $this->smarty->fetch('error.tpl')); $this->assertEquals(Smarty::SMARTY_VERSION, $this->smarty->fetch('error.tpl'));
} }
} }

View File

@@ -291,9 +291,9 @@ class ScopeTest extends PHPUnit_Smarty
'no smarty', $i ++,),); 'no smarty', $i ++,),);
} }
/** /**
* @doesNotPerformAssertions * @doesNotPerformAssertions
*/ */
public function testFunctionScope() public function testFunctionScope()
{ {
$this->smarty->assign('scope', 'none'); $this->smarty->assign('scope', 'none');