diff --git a/.dist/phpstan.neon.dist b/.dist/phpstan.neon.dist index 72767bee6..8b81b19c3 100644 --- a/.dist/phpstan.neon.dist +++ b/.dist/phpstan.neon.dist @@ -52,12 +52,12 @@ parameters: # Scan for type resolution, but do not analyze scanDirectories: - - ../fp-includes/smarty-5.8.0/src + - ../fp-includes/smarty-5.8.4/src - ../fp-includes/fp-smartyplugins excludePaths: analyse: - - ../fp-includes/smarty-5.8.0/** + - ../fp-includes/smarty-5.8.4/** - ../fp-content/compile/** - ../fp-content/cache/** @@ -68,12 +68,12 @@ parameters: # Ignore error “does not accept null” only in Smarty core - message: '#Property .* does not accept null#' paths: - - ../fp-includes/smarty-5.8.0/src/*.php + - ../fp-includes/smarty-5.8.4/src/*.php # Ignore error “Call to undefined method” only in Smarty core - message: '#Call to an undefined method Smarty_Internal_.*::.*#' paths: - - ../fp-includes/smarty-5.8.0/src/.*\.php + - ../fp-includes/smarty-5.8.4/src/.*\.php checkMissingVarTagTypehint: false reportUnmatchedIgnoredErrors: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 7055c179f..322d75e63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ - Added "Location Migration Mode" ([#897](https://github.com/flatpressblog/flatpress/pull/897)) - The PHP code is now fully compliant with PHPStan Level 5 ([#893](https://github.com/flatpressblog/flatpress/pull/893), [#894](https://github.com/flatpressblog/flatpress/pull/894)) - Template engine Smarty: - - Updated to version 5.8.0 with PHP 8.5 support ([#893](https://github.com/flatpressblog/flatpress/pull/893)) + - Updated to version 5.8.4 with PHP 8.5 support ([#932](https://github.com/flatpressblog/flatpress/pull/932)) - New core helpers: ``date_iso8601($timestamp, $offset = null)`` and ``date_id_to_iso8601($id, $offset = null)``. ([#856](https://github.com/flatpressblog/flatpress/pull/856)) - RSS and Atom feeds and the Categories widget use the Smarty block cache instead of having to go through the Smarty compiler every time. ([#864](https://github.com/flatpressblog/flatpress/pull/864)) - If APCu is available, the Smarty cache fragments are stored in the APCu cache instead of on disk. ([#865](https://github.com/flatpressblog/flatpress/pull/865)) diff --git a/fp-includes/smarty-5.8.4/AGENTS.md b/fp-includes/smarty-5.8.4/AGENTS.md new file mode 100644 index 000000000..18729d3ff --- /dev/null +++ b/fp-includes/smarty-5.8.4/AGENTS.md @@ -0,0 +1,87 @@ +# AGENTS.md + +This file is the single source of truth for AI coding assistants working in this repo (including Claude Code, claude.ai/code). + +## Project + +Smarty v5 — PHP template engine. Single Composer package (`smarty/smarty`), namespace `Smarty\`, source in `src/`, autoloaded via PSR-4. Supports PHP 7.2–8.5. + +Do not use PHP syntax newer than 7.2 in `src/` unless it is guarded for older runtimes. + +## Commands + +```bash +# Install dependencies +composer install + +# Regenerate lexers and parsers (required before tests; CI runs this) +make -B + +# Run all tests +php ./vendor/phpunit/phpunit/phpunit + +# Run a single test file +php ./vendor/phpunit/phpunit/phpunit tests/UnitTests/TemplateSource/TagTests/If/CompileIfTest.php + +# Run tests matching a PHPUnit group +php ./vendor/phpunit/phpunit/phpunit --group 20221124 + +# Run tests excluding slow group +php ./vendor/phpunit/phpunit/phpunit --exclude-group slow +``` + +There is no linter or static analysis configured. No typecheck step. + +## Generated code — do not hand-edit + +Four files are generated from grammar/lexer definitions via `make`: + +| Source (edit this) | Generated (do not edit) | +|---|---| +| `src/Lexer/TemplateLexer.plex` | `src/Lexer/TemplateLexer.php` | +| `src/Lexer/ConfigfileLexer.plex` | `src/Lexer/ConfigfileLexer.php` | +| `src/Parser/TemplateParser.y` | `src/Parser/TemplateParser.php` | +| `src/Parser/ConfigfileParser.y` | `src/Parser/ConfigfileParser.php` | + +After editing a `.plex` or `.y` file, run `make -B` to regenerate. The generators require the `smarty/smarty-lexer` dev dependency. + +## Architecture + +- `src/Smarty.php` — main class, extends `TemplateBase`. Version constant: `Smarty::SMARTY_VERSION`. +- `src/Compile/`, `src/Compiler/` — template compilation pipeline. +- `src/Lexer/`, `src/Parser/` — lexer/parser (generated, see above). +- `src/Extension/` — extension system (`ExtensionInterface`, `CoreExtension`, `DefaultExtension`, `BCPluginsAdapter`). +- `src/Runtime/` — runtime helpers (foreach, capture, inheritance, tpl functions). +- `src/Resource/`, `src/Cacheresource/` — template resource and cache resource handlers. +- `src/BlockHandler/`, `src/FunctionHandler/`, `src/Filter/` — built-in tags, functions, and filters. +- `libs/Smarty.class.php` — non-Composer autoload stub. Points to `src/`. Not the main source. +- `src/functions.php` — global helper functions, always loaded via Composer `files` autoload. + +## Tests + +- Framework: PHPUnit 7.5/8.5 (bootstrap: `tests/Bootstrap.php`). +- All tests extend `PHPUnit_Smarty` (defined in `tests/PHPUnit_Smarty.php`), which provides `setUpSmarty($dir)`. +- Test suite root: `tests/UnitTests/`. Typical test `setUp()` calls `$this->setUpSmarty(__DIR__)`. +- Each test directory may have its own `templates/`, `configs/` subdirectories. Compiled output goes to `templates_c/` and `cache/` (auto-created by the test harness). +- Running the suite scatters generated `templates_c/`, `cache/`, and `templates_tmp/` directories (and empty runtime `templates/`/`configs/` dirs) throughout `tests/` and the repo root. These are not tracked — treat them as noise in `git status`, never commit them, and clean them with `git clean -fd` (exclude tool dirs like `.serena`). +- Three test files are excluded in `phpunit.xml`: Memcache, APC, and HttpModifiedSince tests (require external services). +- Tests needing MySQL/PDO are gated by constants in `tests/Config.php` (disabled by default). + +## CI + +GitHub Actions (`.github/workflows/ci.yml`): matrix of PHP 7.2–8.5 on ubuntu + windows. Steps: `composer install` → `make -B` → `phpunit`. No deploy step. + +## Docs + +Markdown in `docs/`, built with mkdocs + Material theme. Install the toolchain with `pip install -r docs/requirements.txt`, then preview with `mkdocs serve`. Published via `mike deploy 5.x`. + +## Release + +`./make-release.sh ` — only v5.x.x. Updates changelog and version constant, creates a merge commit and tag on `master`. + +### Changelog + +Every change that should appear in `CHANGELOG.md` must add a new markdown file under `changelog/`. At release time `utilities/update-changelog.php` concatenates all `changelog/*.md` files into the `## [Unreleased]` section, so: + +- One file per change, containing a single line that starts with a dash (`- ...`). The filename is arbitrary; name it after the issue number (e.g. `1036.md`) when there is one, otherwise use a short descriptive slug. +- Include a markdown link to the relevant issue when one exists, e.g. `[#1036](https://github.com/smarty-php/smarty/issues/1036)`. Omit the link when there is no public issue (e.g. embargoed security reports). diff --git a/fp-includes/smarty-5.8.0/CHANGELOG.md b/fp-includes/smarty-5.8.4/CHANGELOG.md similarity index 98% rename from fp-includes/smarty-5.8.0/CHANGELOG.md rename to fp-includes/smarty-5.8.4/CHANGELOG.md index da75ec2a5..6a048d068 100644 --- a/fp-includes/smarty-5.8.0/CHANGELOG.md +++ b/fp-includes/smarty-5.8.4/CHANGELOG.md @@ -6,6 +6,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.8.4] - 2026-06-29 +- Fixed a `TypeError` on PHP 8 when `Security::$static_classes` was set to a non-array value (e.g. the string `'none'`) to disable static class access; any non-array value now cleanly denies access. Use `Security::$static_classes = null` to disable access to all static classes. +- Security: the built-in `stream:` resource type now validates the nested stream wrapper against the security policy, so a template such as `stream:php://filter/...` can no longer bypass `Security::$streams` (including `Security::$streams = null`) to read local files (CWE-22) + + +## [5.8.3] - 2026-06-28 +- fixed a regression from #1189 where a child template's block override no longer applied to a template {include}d by the parent [#1192](https://github.com/smarty-php/smarty/issues/1192) + + +## [5.8.2] - 2026-06-24 +- Security: prevent symlinks inside a trusted `secure_dir`/template directory from being used to read files outside of it (CWE-22 path traversal), affecting `{include}` and `{fetch}` of local files +- Security: `{html_image}` now escapes the `file`, `path_prefix`, `href`/`link`, `width` and `height` attributes (it already escaped `alt` and pass-through attributes), and `{html_select_date}` casts `day_size`/`month_size`/`year_size` to int (matching `{html_select_time}`), preventing untrusted values passed into these attributes from breaking out of the generated HTML (CWE-79) +- Security: `{fetch}` no longer follows HTTP redirects for remote resources while a security policy is active, preventing an open redirect on a trusted host from bypassing `trusted_uri` (CWE-918 server-side request forgery) +- Fixed "Attempt to assign property step on null" error when using a {for} loop inside a block of an extended template [#1036](https://github.com/smarty-php/smarty/issues/1036) + + +## [5.8.1] - 2026-06-23 +- Re-activated unit tests for user literals, which were previously disabled due to a bug in refactoring to v5. +- fixed a bug where child template's block content leaked into subsequent rendering of the parent template [#1189](https://github.com/smarty-php/smarty/issues/1189) +- Moved all unit test-generated output from inside the working tree to tmp files [#1178](https://github.com/smarty-php/smarty/issues/1178) + + ## [5.8.0] - 2026-02-15 - Added support for Backed Enums for php versions >= 8.1 [#1171](https://github.com/smarty-php/smarty/pull/1171) - Added support for new 'matches' operator doing regex matching [#1169](https://github.com/smarty-php/smarty/pull/1169) diff --git a/fp-includes/smarty-5.8.0/CONTRIBUTING.md b/fp-includes/smarty-5.8.4/CONTRIBUTING.md similarity index 98% rename from fp-includes/smarty-5.8.0/CONTRIBUTING.md rename to fp-includes/smarty-5.8.4/CONTRIBUTING.md index 9cba36246..76832b399 100644 --- a/fp-includes/smarty-5.8.0/CONTRIBUTING.md +++ b/fp-includes/smarty-5.8.4/CONTRIBUTING.md @@ -100,6 +100,11 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/smarty The [docs](docs/index.md) are written in markdown, configured in [mkdocs.yml](mkdocs.yml) and published to [GitHub pages](https://smarty-php.github.io/smarty) using [mkdocs](https://www.mkdocs.org/) and [mike](https://github.com/jimporter/mike). +You need Python to build the docs. Install the required packages first: +```bash +pip install -r docs/requirements.txt +``` + To preview the docs while you are writing, run: ```bash mkdocs serve diff --git a/fp-includes/smarty-5.8.0/LICENSE b/fp-includes/smarty-5.8.4/LICENSE similarity index 100% rename from fp-includes/smarty-5.8.0/LICENSE rename to fp-includes/smarty-5.8.4/LICENSE diff --git a/fp-includes/smarty-5.8.0/Makefile b/fp-includes/smarty-5.8.4/Makefile similarity index 100% rename from fp-includes/smarty-5.8.0/Makefile rename to fp-includes/smarty-5.8.4/Makefile diff --git a/fp-includes/smarty-5.8.0/README.md b/fp-includes/smarty-5.8.4/README.md similarity index 100% rename from fp-includes/smarty-5.8.0/README.md rename to fp-includes/smarty-5.8.4/README.md diff --git a/fp-includes/smarty-5.8.0/SECURITY.md b/fp-includes/smarty-5.8.4/SECURITY.md similarity index 100% rename from fp-includes/smarty-5.8.0/SECURITY.md rename to fp-includes/smarty-5.8.4/SECURITY.md diff --git a/fp-includes/smarty-5.8.0/TODO.txt b/fp-includes/smarty-5.8.4/TODO.txt similarity index 74% rename from fp-includes/smarty-5.8.0/TODO.txt rename to fp-includes/smarty-5.8.4/TODO.txt index aabbf6543..b5be3d240 100644 --- a/fp-includes/smarty-5.8.0/TODO.txt +++ b/fp-includes/smarty-5.8.4/TODO.txt @@ -11,10 +11,10 @@ ## include inline - Re-introduce merge_compiled_includes and the {include inline} attribute? -## Output buffering -- Fix ob_ output buffering commands being scattered around the codebase +## Output buffering (major) +- Fix ob_ output buffering commands being scattered around the codebase: Smarty's output model is fundamentally "echo everything, wrap in a buffer to capture". An alternative that would be where rendering returns a string rather than echoing — but that touches the entire compiled template format (the unifunc functions all echo) and is a large change. -## Review public static vars +## Review public static vars (major) - such as _CHARSET and _IS_WINDOWS ## Block / inheritance @@ -24,9 +24,8 @@ ## Plugin system - fix template security checks in one place in compiler -## Beatify output +## Beatify output (major) - compiled templates could be proper classes, possibly using [nette/php-generator](https://packagist.org/packages/nette/php-generator) ## Unrelated / other - review (and avoid) use of 'clone' keyword -- what is 'user literal support', why are unit tests skipped? diff --git a/fp-includes/smarty-5.8.0/composer.json b/fp-includes/smarty-5.8.4/composer.json similarity index 100% rename from fp-includes/smarty-5.8.0/composer.json rename to fp-includes/smarty-5.8.4/composer.json diff --git a/fp-includes/smarty-5.8.0/libs/Smarty.class.php b/fp-includes/smarty-5.8.4/libs/Smarty.class.php similarity index 100% rename from fp-includes/smarty-5.8.0/libs/Smarty.class.php rename to fp-includes/smarty-5.8.4/libs/Smarty.class.php diff --git a/fp-includes/smarty-5.8.0/mkdocs.yml b/fp-includes/smarty-5.8.4/mkdocs.yml similarity index 100% rename from fp-includes/smarty-5.8.0/mkdocs.yml rename to fp-includes/smarty-5.8.4/mkdocs.yml diff --git a/fp-includes/smarty-5.8.0/run-tests-for-all-php-versions.sh b/fp-includes/smarty-5.8.4/run-tests-for-all-php-versions.sh similarity index 95% rename from fp-includes/smarty-5.8.0/run-tests-for-all-php-versions.sh rename to fp-includes/smarty-5.8.4/run-tests-for-all-php-versions.sh index efff5713d..e873baac6 100644 --- a/fp-includes/smarty-5.8.0/run-tests-for-all-php-versions.sh +++ b/fp-includes/smarty-5.8.4/run-tests-for-all-php-versions.sh @@ -5,7 +5,7 @@ # - ./run-tests-for-all-php-versions.sh --group 20221124 # - ./run-tests-for-all-php-versions.sh --exclude-group slow -COMPOSE_CMD="mutagen-compose" +COMPOSE_CMD="docker compose" $COMPOSE_CMD run --rm php72 ./run-tests.sh $@ && \ $COMPOSE_CMD run --rm php73 ./run-tests.sh $@ && \ diff --git a/fp-includes/smarty-5.8.0/run-tests.sh b/fp-includes/smarty-5.8.4/run-tests.sh similarity index 100% rename from fp-includes/smarty-5.8.0/run-tests.sh rename to fp-includes/smarty-5.8.4/run-tests.sh diff --git a/fp-includes/smarty-5.8.0/src/BlockHandler/Base.php b/fp-includes/smarty-5.8.4/src/BlockHandler/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/BlockHandler/Base.php rename to fp-includes/smarty-5.8.4/src/BlockHandler/Base.php diff --git a/fp-includes/smarty-5.8.0/src/BlockHandler/BlockHandlerInterface.php b/fp-includes/smarty-5.8.4/src/BlockHandler/BlockHandlerInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/BlockHandler/BlockHandlerInterface.php rename to fp-includes/smarty-5.8.4/src/BlockHandler/BlockHandlerInterface.php diff --git a/fp-includes/smarty-5.8.0/src/BlockHandler/BlockPluginWrapper.php b/fp-includes/smarty-5.8.4/src/BlockHandler/BlockPluginWrapper.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/BlockHandler/BlockPluginWrapper.php rename to fp-includes/smarty-5.8.4/src/BlockHandler/BlockPluginWrapper.php diff --git a/fp-includes/smarty-5.8.0/src/BlockHandler/TextFormat.php b/fp-includes/smarty-5.8.4/src/BlockHandler/TextFormat.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/BlockHandler/TextFormat.php rename to fp-includes/smarty-5.8.4/src/BlockHandler/TextFormat.php diff --git a/fp-includes/smarty-5.8.0/src/Cacheresource/Base.php b/fp-includes/smarty-5.8.4/src/Cacheresource/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Cacheresource/Base.php rename to fp-includes/smarty-5.8.4/src/Cacheresource/Base.php diff --git a/fp-includes/smarty-5.8.0/src/Cacheresource/Custom.php b/fp-includes/smarty-5.8.4/src/Cacheresource/Custom.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Cacheresource/Custom.php rename to fp-includes/smarty-5.8.4/src/Cacheresource/Custom.php diff --git a/fp-includes/smarty-5.8.0/src/Cacheresource/File.php b/fp-includes/smarty-5.8.4/src/Cacheresource/File.php similarity index 99% rename from fp-includes/smarty-5.8.0/src/Cacheresource/File.php rename to fp-includes/smarty-5.8.4/src/Cacheresource/File.php index 3cb09b5ec..2df047af3 100644 --- a/fp-includes/smarty-5.8.0/src/Cacheresource/File.php +++ b/fp-includes/smarty-5.8.4/src/Cacheresource/File.php @@ -143,7 +143,7 @@ public function storeCachedContent(Template $_template, $content) * * @param Template $_template template object * - * @return string content + * @return string|false content */ public function retrieveCachedContent(Template $_template) { diff --git a/fp-includes/smarty-5.8.0/src/Cacheresource/KeyValueStore.php b/fp-includes/smarty-5.8.4/src/Cacheresource/KeyValueStore.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Cacheresource/KeyValueStore.php rename to fp-includes/smarty-5.8.4/src/Cacheresource/KeyValueStore.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/AttributeCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/AttributeCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/AttributeCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/AttributeCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Base.php b/fp-includes/smarty-5.8.4/src/Compile/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Base.php rename to fp-includes/smarty-5.8.4/src/Compile/Base.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/BlockCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/BlockCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/BlockCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/BlockCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/CompilerInterface.php b/fp-includes/smarty-5.8.4/src/Compile/CompilerInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/CompilerInterface.php rename to fp-includes/smarty-5.8.4/src/Compile/CompilerInterface.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/DefaultHandlerBlockCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/DefaultHandlerBlockCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/DefaultHandlerBlockCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/DefaultHandlerBlockCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/DefaultHandlerFunctionCallCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/DefaultHandlerFunctionCallCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/DefaultHandlerFunctionCallCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/DefaultHandlerFunctionCallCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/FunctionCallCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/FunctionCallCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/FunctionCallCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/FunctionCallCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/BCPluginWrapper.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/BCPluginWrapper.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/BCPluginWrapper.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/BCPluginWrapper.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/Base.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/Base.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/Base.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/CatModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/CatModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/CatModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/CatModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/CountCharactersModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/CountCharactersModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/CountCharactersModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/CountCharactersModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/CountParagraphsModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/CountParagraphsModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/CountParagraphsModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/CountParagraphsModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/CountSentencesModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/CountSentencesModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/CountSentencesModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/CountSentencesModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/CountWordsModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/CountWordsModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/CountWordsModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/CountWordsModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/DefaultModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/DefaultModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/DefaultModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/DefaultModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/EmptyModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/EmptyModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/EmptyModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/EmptyModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/EscapeModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/EscapeModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/EscapeModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/EscapeModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/FromCharsetModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/FromCharsetModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/FromCharsetModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/FromCharsetModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/IndentModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/IndentModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/IndentModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/IndentModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/IsArrayModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/IsArrayModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/IsArrayModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/IsArrayModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/IssetModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/IssetModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/IssetModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/IssetModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/JsonEncodeModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/JsonEncodeModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/JsonEncodeModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/JsonEncodeModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/LowerModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/LowerModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/LowerModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/LowerModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/ModifierCompilerInterface.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/ModifierCompilerInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/ModifierCompilerInterface.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/ModifierCompilerInterface.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/Nl2brModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/Nl2brModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/Nl2brModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/Nl2brModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/NoPrintModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/NoPrintModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/NoPrintModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/NoPrintModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/RawModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/RawModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/RawModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/RawModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/RoundModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/RoundModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/RoundModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/RoundModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/StrRepeatModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/StrRepeatModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/StrRepeatModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/StrRepeatModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/StringFormatModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/StringFormatModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/StringFormatModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/StringFormatModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/StripModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/StripModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/StripModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/StripModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/StripTagsModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/StripTagsModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/StripTagsModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/StripTagsModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/StrlenModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/StrlenModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/StrlenModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/StrlenModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/SubstrModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/SubstrModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/SubstrModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/SubstrModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/ToCharsetModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/ToCharsetModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/ToCharsetModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/ToCharsetModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/UnescapeModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/UnescapeModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/UnescapeModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/UnescapeModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/UpperModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/UpperModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/UpperModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/UpperModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Modifier/WordWrapModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/Modifier/WordWrapModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Modifier/WordWrapModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/Modifier/WordWrapModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/ModifierCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/ModifierCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/ModifierCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/ModifierCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/ObjectMethodBlockCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/ObjectMethodBlockCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/ObjectMethodBlockCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/ObjectMethodBlockCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/ObjectMethodCallCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/ObjectMethodCallCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/ObjectMethodCallCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/ObjectMethodCallCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/PrintExpressionCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/PrintExpressionCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/PrintExpressionCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/PrintExpressionCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/SpecialVariableCompiler.php b/fp-includes/smarty-5.8.4/src/Compile/SpecialVariableCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/SpecialVariableCompiler.php rename to fp-includes/smarty-5.8.4/src/Compile/SpecialVariableCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Append.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Append.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Append.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Append.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Assign.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Assign.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Assign.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Assign.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/BCPluginWrapper.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/BCPluginWrapper.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/BCPluginWrapper.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/BCPluginWrapper.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Block.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Block.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Block.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Block.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/BlockClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/BlockClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/BlockClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/BlockClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/BreakTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/BreakTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/BreakTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/BreakTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Call.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Call.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Call.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Call.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Capture.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Capture.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Capture.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Capture.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/CaptureClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/CaptureClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/CaptureClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/CaptureClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ConfigLoad.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ConfigLoad.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ConfigLoad.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ConfigLoad.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ContinueTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ContinueTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ContinueTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ContinueTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Debug.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Debug.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Debug.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Debug.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ElseIfTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ElseIfTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ElseIfTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ElseIfTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ElseTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ElseTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ElseTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ElseTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/EvalTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/EvalTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/EvalTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/EvalTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ExtendsTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ExtendsTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ExtendsTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ExtendsTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForElse.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForElse.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForElse.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForElse.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForTag.php similarity index 60% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForTag.php index fdf71b681..b6ff7c564 100644 --- a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForTag.php +++ b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForTag.php @@ -51,8 +51,9 @@ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = $var = $_statement['var']; $index = ''; } - $output .= "\$_smarty_tpl->assign($var, null);\n"; - $output .= "\$_smarty_tpl->tpl_vars[$var]->value{$index} = {$_statement['value']};\n"; + $itemVar = "\$_smarty_tpl->getVariable({$var})"; + $output .= "\$_smarty_tpl->assign($var, []);\n"; + $output .= "{$itemVar}->value{$index} = {$_statement['value']};\n"; } if (is_array($_attr['var'])) { $var = $_attr['var']['var']; @@ -61,7 +62,8 @@ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = $var = $_attr['var']; $index = ''; } - $output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n"; + $itemVar = "\$_smarty_tpl->getVariable({$var})"; + $output .= "if ($_attr[ifexp]) {\nfor (\$_foo=true;$_attr[ifexp]; {$itemVar}->value{$index}$_attr[step]) {\n"; } else { $_statement = $_attr['start']; if (is_array($_statement['var'])) { @@ -71,21 +73,22 @@ public function compile($args, \Smarty\Compiler\Template $compiler, $parameter = $var = $_statement['var']; $index = ''; } - $output .= "\$_smarty_tpl->assign($var, null);"; + $itemVar = "\$_smarty_tpl->getVariable({$var})"; + $output .= "\$_smarty_tpl->assign($var, []);"; if (isset($_attr['step'])) { - $output .= "\$_smarty_tpl->tpl_vars[$var]->step = $_attr[step];"; + $output .= "{$itemVar}->step = $_attr[step];"; } else { - $output .= "\$_smarty_tpl->tpl_vars[$var]->step = 1;"; + $output .= "{$itemVar}->step = 1;"; } if (isset($_attr['max'])) { - $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step)),$_attr[max]);\n"; + $output .= "{$itemVar}->total = (int) min(ceil(({$itemVar}->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs({$itemVar}->step)),$_attr[max]);\n"; } else { - $output .= "\$_smarty_tpl->tpl_vars[$var]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step));\n"; + $output .= "{$itemVar}->total = (int) ceil(({$itemVar}->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs({$itemVar}->step));\n"; } - $output .= "if (\$_smarty_tpl->tpl_vars[$var]->total > 0) {\n"; - $output .= "for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n"; - $output .= "\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration === 1;"; - $output .= "\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration === \$_smarty_tpl->tpl_vars[$var]->total;"; + $output .= "if ({$itemVar}->total > 0) {\n"; + $output .= "for ({$itemVar}->value{$index} = $_statement[value], {$itemVar}->iteration = 1;{$itemVar}->iteration <= {$itemVar}->total;{$itemVar}->value{$index} += {$itemVar}->step, {$itemVar}->iteration++) {\n"; + $output .= "{$itemVar}->first = {$itemVar}->iteration === 1;"; + $output .= "{$itemVar}->last = {$itemVar}->iteration === {$itemVar}->total;"; } $output .= '?>'; diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachElse.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachElse.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachElse.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachElse.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachSection.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachSection.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachSection.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachSection.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/ForeachTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/ForeachTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/FunctionClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/FunctionClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/FunctionClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/FunctionClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/FunctionTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/FunctionTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/FunctionTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/FunctionTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/IfClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/IfClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/IfClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/IfClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/IfTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/IfTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/IfTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/IfTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/IncludeTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/IncludeTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/IncludeTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/IncludeTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Inheritance.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Inheritance.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Inheritance.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Inheritance.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Ldelim.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Ldelim.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Ldelim.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Ldelim.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Nocache.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Nocache.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Nocache.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Nocache.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/NocacheClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/NocacheClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/NocacheClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/NocacheClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Rdelim.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Rdelim.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Rdelim.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Rdelim.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Section.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Section.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Section.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Section.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/SectionClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/SectionClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/SectionClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/SectionClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/SectionElse.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/SectionElse.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/SectionElse.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/SectionElse.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/Setfilter.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/Setfilter.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/Setfilter.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/Setfilter.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/SetfilterClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/SetfilterClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/SetfilterClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/SetfilterClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/WhileClose.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/WhileClose.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/WhileClose.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/WhileClose.php diff --git a/fp-includes/smarty-5.8.0/src/Compile/Tag/WhileTag.php b/fp-includes/smarty-5.8.4/src/Compile/Tag/WhileTag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compile/Tag/WhileTag.php rename to fp-includes/smarty-5.8.4/src/Compile/Tag/WhileTag.php diff --git a/fp-includes/smarty-5.8.0/src/Compiler/BaseCompiler.php b/fp-includes/smarty-5.8.4/src/Compiler/BaseCompiler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compiler/BaseCompiler.php rename to fp-includes/smarty-5.8.4/src/Compiler/BaseCompiler.php diff --git a/fp-includes/smarty-5.8.0/src/Compiler/CodeFrame.php b/fp-includes/smarty-5.8.4/src/Compiler/CodeFrame.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compiler/CodeFrame.php rename to fp-includes/smarty-5.8.4/src/Compiler/CodeFrame.php diff --git a/fp-includes/smarty-5.8.0/src/Compiler/Configfile.php b/fp-includes/smarty-5.8.4/src/Compiler/Configfile.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compiler/Configfile.php rename to fp-includes/smarty-5.8.4/src/Compiler/Configfile.php diff --git a/fp-includes/smarty-5.8.0/src/Compiler/Template.php b/fp-includes/smarty-5.8.4/src/Compiler/Template.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Compiler/Template.php rename to fp-includes/smarty-5.8.4/src/Compiler/Template.php diff --git a/fp-includes/smarty-5.8.0/src/CompilerException.php b/fp-includes/smarty-5.8.4/src/CompilerException.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/CompilerException.php rename to fp-includes/smarty-5.8.4/src/CompilerException.php diff --git a/fp-includes/smarty-5.8.0/src/Data.php b/fp-includes/smarty-5.8.4/src/Data.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Data.php rename to fp-includes/smarty-5.8.4/src/Data.php diff --git a/fp-includes/smarty-5.8.0/src/Debug.php b/fp-includes/smarty-5.8.4/src/Debug.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Debug.php rename to fp-includes/smarty-5.8.4/src/Debug.php diff --git a/fp-includes/smarty-5.8.0/src/ErrorHandler.php b/fp-includes/smarty-5.8.4/src/ErrorHandler.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ErrorHandler.php rename to fp-includes/smarty-5.8.4/src/ErrorHandler.php diff --git a/fp-includes/smarty-5.8.0/src/Exception.php b/fp-includes/smarty-5.8.4/src/Exception.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Exception.php rename to fp-includes/smarty-5.8.4/src/Exception.php diff --git a/fp-includes/smarty-5.8.0/src/Extension/BCPluginsAdapter.php b/fp-includes/smarty-5.8.4/src/Extension/BCPluginsAdapter.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Extension/BCPluginsAdapter.php rename to fp-includes/smarty-5.8.4/src/Extension/BCPluginsAdapter.php diff --git a/fp-includes/smarty-5.8.0/src/Extension/Base.php b/fp-includes/smarty-5.8.4/src/Extension/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Extension/Base.php rename to fp-includes/smarty-5.8.4/src/Extension/Base.php diff --git a/fp-includes/smarty-5.8.0/src/Extension/CallbackWrapper.php b/fp-includes/smarty-5.8.4/src/Extension/CallbackWrapper.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Extension/CallbackWrapper.php rename to fp-includes/smarty-5.8.4/src/Extension/CallbackWrapper.php diff --git a/fp-includes/smarty-5.8.0/src/Extension/CoreExtension.php b/fp-includes/smarty-5.8.4/src/Extension/CoreExtension.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Extension/CoreExtension.php rename to fp-includes/smarty-5.8.4/src/Extension/CoreExtension.php diff --git a/fp-includes/smarty-5.8.0/src/Extension/DefaultExtension.php b/fp-includes/smarty-5.8.4/src/Extension/DefaultExtension.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Extension/DefaultExtension.php rename to fp-includes/smarty-5.8.4/src/Extension/DefaultExtension.php diff --git a/fp-includes/smarty-5.8.0/src/Extension/ExtensionInterface.php b/fp-includes/smarty-5.8.4/src/Extension/ExtensionInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Extension/ExtensionInterface.php rename to fp-includes/smarty-5.8.4/src/Extension/ExtensionInterface.php diff --git a/fp-includes/smarty-5.8.0/src/Filter/FilterInterface.php b/fp-includes/smarty-5.8.4/src/Filter/FilterInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Filter/FilterInterface.php rename to fp-includes/smarty-5.8.4/src/Filter/FilterInterface.php diff --git a/fp-includes/smarty-5.8.0/src/Filter/FilterPluginWrapper.php b/fp-includes/smarty-5.8.4/src/Filter/FilterPluginWrapper.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Filter/FilterPluginWrapper.php rename to fp-includes/smarty-5.8.4/src/Filter/FilterPluginWrapper.php diff --git a/fp-includes/smarty-5.8.0/src/Filter/Output/TrimWhitespace.php b/fp-includes/smarty-5.8.4/src/Filter/Output/TrimWhitespace.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Filter/Output/TrimWhitespace.php rename to fp-includes/smarty-5.8.4/src/Filter/Output/TrimWhitespace.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/AttributeBase.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/AttributeBase.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/AttributeBase.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/AttributeBase.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/AttributeFunctionHandlerInterface.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/AttributeFunctionHandlerInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/AttributeFunctionHandlerInterface.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/AttributeFunctionHandlerInterface.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/BCPluginWrapper.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/BCPluginWrapper.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/BCPluginWrapper.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/BCPluginWrapper.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Base.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Base.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Base.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Count.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Count.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Count.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Count.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Counter.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Counter.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Counter.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Counter.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Cycle.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Cycle.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Cycle.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Cycle.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Fetch.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Fetch.php similarity index 89% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Fetch.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Fetch.php index d10ef668f..fb6337161 100644 --- a/fp-includes/smarty-5.8.0/src/FunctionHandler/Fetch.php +++ b/fp-includes/smarty-5.8.4/src/FunctionHandler/Fetch.php @@ -189,7 +189,22 @@ public function handle($params, Template $template) { return; } } else { - $content = @file_get_contents($params['file']); + if ($protocol && isset($template->getSmarty()->security_policy)) { + // Remote resource (e.g. https://) reached through file_get_contents(). + // isTrustedUri() only validates the initial URL, but file_get_contents() + // follows redirects by default, so an open redirect on an otherwise + // trusted host could be used to reach a non-trusted target (SSRF). + // Disable redirect-following while a security policy is in effect. + $context = stream_context_create([ + 'http' => [ + 'follow_location' => 0, + 'max_redirects' => 1, + ], + ]); + $content = @file_get_contents($params['file'], false, $context); + } else { + $content = @file_get_contents($params['file']); + } if ($content === false) { throw new Exception("{fetch} cannot read resource '" . $params['file'] . "'"); } diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/FunctionHandlerInterface.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/FunctionHandlerInterface.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/FunctionHandlerInterface.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/FunctionHandlerInterface.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlBase.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlBase.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlBase.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlBase.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlCheckboxes.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlCheckboxes.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlCheckboxes.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlCheckboxes.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlImage.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlImage.php similarity index 86% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlImage.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlImage.php index 9cb087456..f26a10c64 100644 --- a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlImage.php +++ b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlImage.php @@ -65,7 +65,7 @@ public function handle($params, Template $template) { break; case 'link': case 'href': - $prefix = ''; + $prefix = ''; $suffix = ''; break; default: @@ -143,7 +143,12 @@ public function handle($params, Template $template) { $width = round($width * $_resize); $height = round($height * $_resize); } - return $prefix . '' . $alt . '' . $suffix; + // $alt and the pass-through attributes ($extra) are already escaped above; + // escape the remaining value-context params at output time so untrusted + // values cannot break out of the attribute (CWE-79). The unescaped $file/ + // $width/$height are still used for getimagesize()/DPI math above. + return $prefix . '' . $alt
+			. '' . $suffix; } } \ No newline at end of file diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlOptions.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlOptions.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlOptions.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlOptions.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlRadios.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlRadios.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlRadios.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlRadios.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlSelectDate.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlSelectDate.php similarity index 98% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlSelectDate.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlSelectDate.php index a6acfb7bd..84d0059c1 100644 --- a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlSelectDate.php +++ b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlSelectDate.php @@ -120,9 +120,6 @@ public function handle($params, Template $template) { case 'day_value_format': case 'month_format': case 'month_value_format': - case 'day_size': - case 'month_size': - case 'year_size': case 'all_extra': case 'day_extra': case 'month_extra': @@ -140,6 +137,13 @@ public function handle($params, Template $template) { case 'year_id': $$_key = (string)$_value; break; + case 'day_size': + case 'month_size': + case 'year_size': + // numeric HTML size attribute; cast to int (consistent with + // html_select_time) so it cannot break out of size="…" (CWE-79) + $$_key = (int)$_value; + break; case 'display_days': case 'display_months': case 'display_years': diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlSelectTime.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlSelectTime.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlSelectTime.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlSelectTime.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlTable.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlTable.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/HtmlTable.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/HtmlTable.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Mailto.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Mailto.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Mailto.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Mailto.php diff --git a/fp-includes/smarty-5.8.0/src/FunctionHandler/Math.php b/fp-includes/smarty-5.8.4/src/FunctionHandler/Math.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/FunctionHandler/Math.php rename to fp-includes/smarty-5.8.4/src/FunctionHandler/Math.php diff --git a/fp-includes/smarty-5.8.0/src/Lexer/ConfigfileLexer.php b/fp-includes/smarty-5.8.4/src/Lexer/ConfigfileLexer.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Lexer/ConfigfileLexer.php rename to fp-includes/smarty-5.8.4/src/Lexer/ConfigfileLexer.php diff --git a/fp-includes/smarty-5.8.0/src/Lexer/ConfigfileLexer.plex b/fp-includes/smarty-5.8.4/src/Lexer/ConfigfileLexer.plex similarity index 100% rename from fp-includes/smarty-5.8.0/src/Lexer/ConfigfileLexer.plex rename to fp-includes/smarty-5.8.4/src/Lexer/ConfigfileLexer.plex diff --git a/fp-includes/smarty-5.8.0/src/Lexer/TemplateLexer.php b/fp-includes/smarty-5.8.4/src/Lexer/TemplateLexer.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Lexer/TemplateLexer.php rename to fp-includes/smarty-5.8.4/src/Lexer/TemplateLexer.php diff --git a/fp-includes/smarty-5.8.0/src/Lexer/TemplateLexer.plex b/fp-includes/smarty-5.8.4/src/Lexer/TemplateLexer.plex similarity index 100% rename from fp-includes/smarty-5.8.0/src/Lexer/TemplateLexer.plex rename to fp-includes/smarty-5.8.4/src/Lexer/TemplateLexer.plex diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/Base.php b/fp-includes/smarty-5.8.4/src/ParseTree/Base.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/Base.php rename to fp-includes/smarty-5.8.4/src/ParseTree/Base.php diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/Code.php b/fp-includes/smarty-5.8.4/src/ParseTree/Code.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/Code.php rename to fp-includes/smarty-5.8.4/src/ParseTree/Code.php diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/Dq.php b/fp-includes/smarty-5.8.4/src/ParseTree/Dq.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/Dq.php rename to fp-includes/smarty-5.8.4/src/ParseTree/Dq.php diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/DqContent.php b/fp-includes/smarty-5.8.4/src/ParseTree/DqContent.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/DqContent.php rename to fp-includes/smarty-5.8.4/src/ParseTree/DqContent.php diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/Tag.php b/fp-includes/smarty-5.8.4/src/ParseTree/Tag.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/Tag.php rename to fp-includes/smarty-5.8.4/src/ParseTree/Tag.php diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/Template.php b/fp-includes/smarty-5.8.4/src/ParseTree/Template.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/Template.php rename to fp-includes/smarty-5.8.4/src/ParseTree/Template.php diff --git a/fp-includes/smarty-5.8.0/src/ParseTree/Text.php b/fp-includes/smarty-5.8.4/src/ParseTree/Text.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/ParseTree/Text.php rename to fp-includes/smarty-5.8.4/src/ParseTree/Text.php diff --git a/fp-includes/smarty-5.8.0/src/Parser/ConfigfileParser.php b/fp-includes/smarty-5.8.4/src/Parser/ConfigfileParser.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Parser/ConfigfileParser.php rename to fp-includes/smarty-5.8.4/src/Parser/ConfigfileParser.php diff --git a/fp-includes/smarty-5.8.0/src/Parser/ConfigfileParser.y b/fp-includes/smarty-5.8.4/src/Parser/ConfigfileParser.y similarity index 100% rename from fp-includes/smarty-5.8.0/src/Parser/ConfigfileParser.y rename to fp-includes/smarty-5.8.4/src/Parser/ConfigfileParser.y diff --git a/fp-includes/smarty-5.8.0/src/Parser/TemplateParser.php b/fp-includes/smarty-5.8.4/src/Parser/TemplateParser.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Parser/TemplateParser.php rename to fp-includes/smarty-5.8.4/src/Parser/TemplateParser.php diff --git a/fp-includes/smarty-5.8.0/src/Parser/TemplateParser.y b/fp-includes/smarty-5.8.4/src/Parser/TemplateParser.y similarity index 100% rename from fp-includes/smarty-5.8.0/src/Parser/TemplateParser.y rename to fp-includes/smarty-5.8.4/src/Parser/TemplateParser.y diff --git a/fp-includes/smarty-5.8.0/src/Resource/BasePlugin.php b/fp-includes/smarty-5.8.4/src/Resource/BasePlugin.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/BasePlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/BasePlugin.php diff --git a/fp-includes/smarty-5.8.0/src/Resource/CustomPlugin.php b/fp-includes/smarty-5.8.4/src/Resource/CustomPlugin.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/CustomPlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/CustomPlugin.php diff --git a/fp-includes/smarty-5.8.0/src/Resource/ExtendsPlugin.php b/fp-includes/smarty-5.8.4/src/Resource/ExtendsPlugin.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/ExtendsPlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/ExtendsPlugin.php diff --git a/fp-includes/smarty-5.8.0/src/Resource/FilePlugin.php b/fp-includes/smarty-5.8.4/src/Resource/FilePlugin.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/FilePlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/FilePlugin.php diff --git a/fp-includes/smarty-5.8.0/src/Resource/RecompiledPlugin.php b/fp-includes/smarty-5.8.4/src/Resource/RecompiledPlugin.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/RecompiledPlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/RecompiledPlugin.php diff --git a/fp-includes/smarty-5.8.0/src/Resource/StreamPlugin.php b/fp-includes/smarty-5.8.4/src/Resource/StreamPlugin.php similarity index 67% rename from fp-includes/smarty-5.8.0/src/Resource/StreamPlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/StreamPlugin.php index 9b5b3f579..9e738f046 100644 --- a/fp-includes/smarty-5.8.0/src/Resource/StreamPlugin.php +++ b/fp-includes/smarty-5.8.4/src/Resource/StreamPlugin.php @@ -54,8 +54,19 @@ public function getContent(Source $source) { $filepath = str_replace(':', '://', $source->getFullResourceName()); } + // Validate the underlying stream wrapper against the security policy. + // When the built-in "stream" resource type is used (e.g. + // stream:php://filter/...), BasePlugin::load() matches the "stream" + // sysplugin before the stream_get_wrappers()/isTrustedStream() check, + // so the nested wrapper ("php" here) is never validated. Parse the + // wrapper scheme from the resolved path and check it explicitly so that + // e.g. Security::$streams = null blocks it before fopen() (CWE-22/-441). + $smarty = $source->getSmarty(); + if (is_object($smarty->security_policy) && ($_pos = strpos($filepath, '://')) !== false) { + $smarty->security_policy->isTrustedStream(strtolower(substr($filepath, 0, $_pos))); + } + $t = ''; - // the availability of the stream has already been checked in Smarty\Resource\Base::fetch() $fp = fopen($filepath, 'r+'); if ($fp) { while (!feof($fp) && ($current_line = fgets($fp)) !== false) { diff --git a/fp-includes/smarty-5.8.0/src/Resource/StringEval.php b/fp-includes/smarty-5.8.4/src/Resource/StringEval.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/StringEval.php rename to fp-includes/smarty-5.8.4/src/Resource/StringEval.php diff --git a/fp-includes/smarty-5.8.0/src/Resource/StringPlugin.php b/fp-includes/smarty-5.8.4/src/Resource/StringPlugin.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Resource/StringPlugin.php rename to fp-includes/smarty-5.8.4/src/Resource/StringPlugin.php diff --git a/fp-includes/smarty-5.8.0/src/Runtime/Block.php b/fp-includes/smarty-5.8.4/src/Runtime/Block.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Runtime/Block.php rename to fp-includes/smarty-5.8.4/src/Runtime/Block.php diff --git a/fp-includes/smarty-5.8.0/src/Runtime/CaptureRuntime.php b/fp-includes/smarty-5.8.4/src/Runtime/CaptureRuntime.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Runtime/CaptureRuntime.php rename to fp-includes/smarty-5.8.4/src/Runtime/CaptureRuntime.php diff --git a/fp-includes/smarty-5.8.0/src/Runtime/DefaultPluginHandlerRuntime.php b/fp-includes/smarty-5.8.4/src/Runtime/DefaultPluginHandlerRuntime.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Runtime/DefaultPluginHandlerRuntime.php rename to fp-includes/smarty-5.8.4/src/Runtime/DefaultPluginHandlerRuntime.php diff --git a/fp-includes/smarty-5.8.0/src/Runtime/ForeachRuntime.php b/fp-includes/smarty-5.8.4/src/Runtime/ForeachRuntime.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Runtime/ForeachRuntime.php rename to fp-includes/smarty-5.8.4/src/Runtime/ForeachRuntime.php diff --git a/fp-includes/smarty-5.8.0/src/Runtime/InheritanceRuntime.php b/fp-includes/smarty-5.8.4/src/Runtime/InheritanceRuntime.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Runtime/InheritanceRuntime.php rename to fp-includes/smarty-5.8.4/src/Runtime/InheritanceRuntime.php diff --git a/fp-includes/smarty-5.8.0/src/Runtime/TplFunctionRuntime.php b/fp-includes/smarty-5.8.4/src/Runtime/TplFunctionRuntime.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Runtime/TplFunctionRuntime.php rename to fp-includes/smarty-5.8.4/src/Runtime/TplFunctionRuntime.php diff --git a/fp-includes/smarty-5.8.0/src/Security.php b/fp-includes/smarty-5.8.4/src/Security.php similarity index 90% rename from fp-includes/smarty-5.8.0/src/Security.php rename to fp-includes/smarty-5.8.4/src/Security.php index 250b3bca7..325dac652 100644 --- a/fp-includes/smarty-5.8.0/src/Security.php +++ b/fp-includes/smarty-5.8.4/src/Security.php @@ -52,7 +52,7 @@ class Security { /** * This is an array of trusted static classes. * If empty access to all static classes is allowed. - * If set to 'none' none is allowed. + * To disable access to all static classes set $static_classes = null. * * @var array */ @@ -206,7 +206,11 @@ public function __construct(Smarty $smarty) { * @return boolean true if class is trusted */ public function isTrustedStaticClass($class_name, $compiler) { - if (isset($this->static_classes) + // Only an array enables access: an empty array allows all classes, a + // populated array is an allowlist. Any other value (null, or the + // documented "none") denies all. Using is_array() rather than isset() + // also avoids a PHP 8 TypeError from passing a non-array to in_array(). + if (is_array($this->static_classes) && (empty($this->static_classes) || in_array($class_name, $this->static_classes)) ) { return true; @@ -474,12 +478,34 @@ private function _updateResourceDir($oldDir, $newDir) { * @throws \Smarty\Exception */ private function _checkDir($filepath, $dirs) { - $directory = dirname($this->smarty->_realpath($filepath, true)) . DIRECTORY_SEPARATOR; + // Resolve the canonical, symlink-free path of the requested file so that + // a symlink located inside a trusted directory cannot be abused to read + // a file outside of it (CWE-22 path traversal). Smarty::_realpath() only + // normalizes the path as a string and does not follow symlinks, so we + // fall back to it only when the file does not yet exist on disk (e.g. + // config/cache paths that are validated before being written). + $realpath = @realpath($filepath); + $resolved = $realpath !== false ? $realpath : $this->smarty->_realpath($filepath, true); + $directory = dirname($resolved) . DIRECTORY_SEPARATOR; + + // Canonicalize the trusted directories the same way. This keeps + // legitimate symlinked deployment paths working (e.g. a Capistrano-style + // "current" release symlink, or macOS' /var -> /private/var): both the + // file and the trusted directories are compared after symlinks have been + // resolved. + $trusted = []; + foreach ($dirs as $dir => $unused) { + $trusted[$dir] = true; + if (($dirRealpath = @realpath($dir)) !== false) { + $trusted[rtrim($dirRealpath, '\\/') . DIRECTORY_SEPARATOR] = true; + } + } + $_directory = []; if (!preg_match('#[\\\\/][.][.][\\\\/]#', $directory)) { while (true) { // test if the directory is trusted - if (isset($dirs[$directory])) { + if (isset($trusted[$directory])) { return $_directory; } // abort if we've reached root diff --git a/fp-includes/smarty-5.8.0/src/Smarty.php b/fp-includes/smarty-5.8.4/src/Smarty.php similarity index 99% rename from fp-includes/smarty-5.8.0/src/Smarty.php rename to fp-includes/smarty-5.8.4/src/Smarty.php index 62e44bee6..729f33b14 100644 --- a/fp-includes/smarty-5.8.0/src/Smarty.php +++ b/fp-includes/smarty-5.8.4/src/Smarty.php @@ -54,7 +54,7 @@ class Smarty extends \Smarty\TemplateBase { /** * smarty version */ - const SMARTY_VERSION = '5.8.0'; + const SMARTY_VERSION = '5.8.4'; /** * define caching modes diff --git a/fp-includes/smarty-5.8.0/src/Template.php b/fp-includes/smarty-5.8.4/src/Template.php similarity index 97% rename from fp-includes/smarty-5.8.0/src/Template.php rename to fp-includes/smarty-5.8.4/src/Template.php index 242fb2388..5a8363a54 100644 --- a/fp-includes/smarty-5.8.0/src/Template.php +++ b/fp-includes/smarty-5.8.4/src/Template.php @@ -260,7 +260,11 @@ public function renderSubTemplate( $tpl = $this->smarty->doCreateTemplate($template_name, $cache_id, $compile_id, $this, $caching, $cache_lifetime); - $tpl->inheritance = $this->getInheritance(); // re-use the same Inheritance object inside the inheritance tree + // Re-use the same Inheritance object only inside an active inheritance tree, i.e. when this + // (including) template already has one. A template outside any inheritance tree has no + // Inheritance object (null); sub-templates it {include}s must then start with their own, so an + // {include}d template that uses {block}/{extends} creates a fresh root via getInheritance(). + $tpl->inheritance = $this->inheritance; if ($scope) { $tpl->defaultScope = $scope; diff --git a/fp-includes/smarty-5.8.0/src/Template/Cached.php b/fp-includes/smarty-5.8.4/src/Template/Cached.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Template/Cached.php rename to fp-includes/smarty-5.8.4/src/Template/Cached.php diff --git a/fp-includes/smarty-5.8.0/src/Template/Compiled.php b/fp-includes/smarty-5.8.4/src/Template/Compiled.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Template/Compiled.php rename to fp-includes/smarty-5.8.4/src/Template/Compiled.php diff --git a/fp-includes/smarty-5.8.0/src/Template/Config.php b/fp-includes/smarty-5.8.4/src/Template/Config.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Template/Config.php rename to fp-includes/smarty-5.8.4/src/Template/Config.php diff --git a/fp-includes/smarty-5.8.0/src/Template/GeneratedPhpFile.php b/fp-includes/smarty-5.8.4/src/Template/GeneratedPhpFile.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Template/GeneratedPhpFile.php rename to fp-includes/smarty-5.8.4/src/Template/GeneratedPhpFile.php diff --git a/fp-includes/smarty-5.8.0/src/Template/Source.php b/fp-includes/smarty-5.8.4/src/Template/Source.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Template/Source.php rename to fp-includes/smarty-5.8.4/src/Template/Source.php diff --git a/fp-includes/smarty-5.8.0/src/TemplateBase.php b/fp-includes/smarty-5.8.4/src/TemplateBase.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/TemplateBase.php rename to fp-includes/smarty-5.8.4/src/TemplateBase.php diff --git a/fp-includes/smarty-5.8.0/src/TestInstall.php b/fp-includes/smarty-5.8.4/src/TestInstall.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/TestInstall.php rename to fp-includes/smarty-5.8.4/src/TestInstall.php diff --git a/fp-includes/smarty-5.8.0/src/UndefinedVariable.php b/fp-includes/smarty-5.8.4/src/UndefinedVariable.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/UndefinedVariable.php rename to fp-includes/smarty-5.8.4/src/UndefinedVariable.php diff --git a/fp-includes/smarty-5.8.0/src/Variable.php b/fp-includes/smarty-5.8.4/src/Variable.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/Variable.php rename to fp-includes/smarty-5.8.4/src/Variable.php diff --git a/fp-includes/smarty-5.8.0/src/debug.tpl b/fp-includes/smarty-5.8.4/src/debug.tpl similarity index 100% rename from fp-includes/smarty-5.8.0/src/debug.tpl rename to fp-includes/smarty-5.8.4/src/debug.tpl diff --git a/fp-includes/smarty-5.8.0/src/functions.php b/fp-includes/smarty-5.8.4/src/functions.php similarity index 100% rename from fp-includes/smarty-5.8.0/src/functions.php rename to fp-includes/smarty-5.8.4/src/functions.php