From 3f871f9f7ac61c03b04855d7b73c45fb772abf7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=BChauf?= Date: Wed, 27 Mar 2024 11:47:42 +0100 Subject: [PATCH 1/4] Fix docblock information after Smarty 5 namespace changes (#968) --- src/TemplateBase.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TemplateBase.php b/src/TemplateBase.php index a2a420c07..4dab470f9 100644 --- a/src/TemplateBase.php +++ b/src/TemplateBase.php @@ -377,9 +377,9 @@ public function registerDefaultTemplateHandler($callback) { * Registers a resource to fetch a template * * @param string $name name of resource type - * @param Smarty\Resource\Base $resource_handler instance of Smarty\Resource\Base + * @param \Smarty\Resource\BasePlugin $resource_handler instance of Smarty\Resource\BasePlugin * - * @return \Smarty|\Smarty\Template + * @return \Smarty\Smarty|\Smarty\Template * @link https://www.smarty.net/docs/en/api.register.resource.tpl * * @api Smarty::registerResource() From 30b1c5bf6dbf48fdd154c2fe878522602532bc47 Mon Sep 17 00:00:00 2001 From: Wim Wisselink Date: Wed, 27 Mar 2024 11:48:38 +0100 Subject: [PATCH 2/4] Deprecation fix for providing a non string value to ctype_digit (#960) --- src/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/functions.php b/src/functions.php index 5396ffcb9..590789ba3 100644 --- a/src/functions.php +++ b/src/functions.php @@ -66,7 +66,7 @@ function smarty_make_timestamp($string) || (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface) ) { return (int)$string->format('U'); // PHP 5.2 BC - } elseif (strlen($string) === 14 && ctype_digit($string)) { + } elseif (strlen($string) === 14 && ctype_digit((string)$string)) { // it is mysql timestamp format of YYYYMMDDHHMMSS? return mktime( substr($string, 8, 2), From 4efa427a872ad51571d3d2b2c3122fafbf3386d2 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Wed, 27 Mar 2024 22:53:03 +0100 Subject: [PATCH 3/4] Fix missing and bogus use lines in src/Smarty.php. (#970) --- changelog/966.md | 1 + src/Smarty.php | 26 ++++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 changelog/966.md diff --git a/changelog/966.md b/changelog/966.md new file mode 100644 index 000000000..5332ce59c --- /dev/null +++ b/changelog/966.md @@ -0,0 +1 @@ +- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966) \ No newline at end of file diff --git a/src/Smarty.php b/src/Smarty.php index 6925d4060..0f6ee0ce7 100644 --- a/src/Smarty.php +++ b/src/Smarty.php @@ -2,6 +2,7 @@ namespace Smarty; +use FilesystemIterator; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; use Smarty\Cacheresource\File; @@ -12,11 +13,12 @@ use Smarty\Extension\DefaultExtension; use Smarty\Extension\ExtensionInterface; use Smarty\Filter\Output\TrimWhitespace; -use Smarty\Resource\BasePlugin; -use Smarty\Smarty\Runtime\CaptureRuntime; -use Smarty\Smarty\Runtime\ForeachRuntime; -use Smarty\Smarty\Runtime\InheritanceRuntime; -use Smarty\Smarty\Runtime\TplFunctionRuntime; +use Smarty\Runtime\CaptureRuntime; +use Smarty\Runtime\DefaultPluginHandlerRuntime; +use Smarty\Runtime\ForeachRuntime; +use Smarty\Runtime\InheritanceRuntime; +use Smarty\Runtime\TplFunctionRuntime; + /** * Project: Smarty: the PHP compiling template engine @@ -1755,15 +1757,15 @@ public function getRuntime(string $type) { // Lazy load runtimes when/if needed switch ($type) { case 'Capture': - return $this->runtimes[$type] = new \Smarty\Runtime\CaptureRuntime(); + return $this->runtimes[$type] = new CaptureRuntime(); case 'Foreach': - return $this->runtimes[$type] = new \Smarty\Runtime\ForeachRuntime(); + return $this->runtimes[$type] = new ForeachRuntime(); case 'Inheritance': - return $this->runtimes[$type] = new \Smarty\Runtime\InheritanceRuntime(); + return $this->runtimes[$type] = new InheritanceRuntime(); case 'TplFunction': - return $this->runtimes[$type] = new \Smarty\Runtime\TplFunctionRuntime(); + return $this->runtimes[$type] = new TplFunctionRuntime(); case 'DefaultPluginHandler': - return $this->runtimes[$type] = new \Smarty\Runtime\DefaultPluginHandlerRuntime( + return $this->runtimes[$type] = new DefaultPluginHandlerRuntime( $this->getDefaultPluginHandlerFunc() ); } @@ -2052,7 +2054,7 @@ public function unregisterFilter($type, $name) { * @param array|string $modifiers modifier or list of modifiers * to add * - * @return \Smarty|Template + * @return Smarty * @api Smarty::addDefaultModifiers() * */ @@ -2131,7 +2133,7 @@ public function fetch($template = null, $cache_id = null, $compile_id = null) { * @throws \Smarty\Exception */ public function display($template = null, $cache_id = null, $compile_id = null) { - return $this->returnOrCreateTemplate($template, $cache_id, $compile_id)->display(); + $this->returnOrCreateTemplate($template, $cache_id, $compile_id)->display(); } /** From 82a815aafb15a3ce89d04a625532523cfb971cc5 Mon Sep 17 00:00:00 2001 From: Simon Wisselink Date: Wed, 27 Mar 2024 22:57:04 +0100 Subject: [PATCH 4/4] version bump --- CHANGELOG.md | 4 ++++ changelog/966.md | 1 - src/Smarty.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) delete mode 100644 changelog/966.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 724651bc2..274c3b74a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.0.1] - 2024-03-27 +- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966) + + ## [5.0.0] - 2024-03-25 - Fixed that scoped variables would overwrite parent scope [#952](https://github.com/smarty-php/smarty/issues/952) - Removed publicly accessible `$tpl->_var_stack` variable diff --git a/changelog/966.md b/changelog/966.md deleted file mode 100644 index 5332ce59c..000000000 --- a/changelog/966.md +++ /dev/null @@ -1 +0,0 @@ -- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966) \ No newline at end of file diff --git a/src/Smarty.php b/src/Smarty.php index 0f6ee0ce7..bf1d3fad5 100644 --- a/src/Smarty.php +++ b/src/Smarty.php @@ -55,7 +55,7 @@ class Smarty extends \Smarty\TemplateBase { /** * smarty version */ - const SMARTY_VERSION = '5.0.0'; + const SMARTY_VERSION = '5.0.1'; /** * define caching modes