Fix missing and bogus use lines in src/Smarty.php.

This commit is contained in:
Simon Wisselink
2024-03-27 21:52:23 +01:00
parent 1da30e76e8
commit 263c9cd3cd
2 changed files with 16 additions and 13 deletions

1
changelog/966.md Normal file
View File

@@ -0,0 +1 @@
- Fix error in Smarty\Smarty::compileAllTemplates() by including missing FilesystemIterator class [#966](https://github.com/smarty-php/smarty/issues/966)

View File

@@ -2,6 +2,7 @@
namespace Smarty; namespace Smarty;
use FilesystemIterator;
use RecursiveDirectoryIterator; use RecursiveDirectoryIterator;
use RecursiveIteratorIterator; use RecursiveIteratorIterator;
use Smarty\Cacheresource\File; use Smarty\Cacheresource\File;
@@ -12,11 +13,12 @@ use Smarty\Extension\CoreExtension;
use Smarty\Extension\DefaultExtension; use Smarty\Extension\DefaultExtension;
use Smarty\Extension\ExtensionInterface; use Smarty\Extension\ExtensionInterface;
use Smarty\Filter\Output\TrimWhitespace; use Smarty\Filter\Output\TrimWhitespace;
use Smarty\Resource\BasePlugin; use Smarty\Runtime\CaptureRuntime;
use Smarty\Smarty\Runtime\CaptureRuntime; use Smarty\Runtime\DefaultPluginHandlerRuntime;
use Smarty\Smarty\Runtime\ForeachRuntime; use Smarty\Runtime\ForeachRuntime;
use Smarty\Smarty\Runtime\InheritanceRuntime; use Smarty\Runtime\InheritanceRuntime;
use Smarty\Smarty\Runtime\TplFunctionRuntime; use Smarty\Runtime\TplFunctionRuntime;
/** /**
* Project: Smarty: the PHP compiling template engine * Project: Smarty: the PHP compiling template engine
@@ -1337,7 +1339,7 @@ class Smarty extends \Smarty\TemplateBase {
} }
$_filepath = (string)$_file; $_filepath = (string)$_file;
if ($_file->isDir()) { if ($_file->isDir()) {
if (!$_compile->isDot()) { if (!$_file->isDot()) {
// delete folder if empty // delete folder if empty
@rmdir($_file->getPathname()); @rmdir($_file->getPathname());
} }
@@ -1755,15 +1757,15 @@ class Smarty extends \Smarty\TemplateBase {
// Lazy load runtimes when/if needed // Lazy load runtimes when/if needed
switch ($type) { switch ($type) {
case 'Capture': case 'Capture':
return $this->runtimes[$type] = new \Smarty\Runtime\CaptureRuntime(); return $this->runtimes[$type] = new CaptureRuntime();
case 'Foreach': case 'Foreach':
return $this->runtimes[$type] = new \Smarty\Runtime\ForeachRuntime(); return $this->runtimes[$type] = new ForeachRuntime();
case 'Inheritance': case 'Inheritance':
return $this->runtimes[$type] = new \Smarty\Runtime\InheritanceRuntime(); return $this->runtimes[$type] = new InheritanceRuntime();
case 'TplFunction': case 'TplFunction':
return $this->runtimes[$type] = new \Smarty\Runtime\TplFunctionRuntime(); return $this->runtimes[$type] = new TplFunctionRuntime();
case 'DefaultPluginHandler': case 'DefaultPluginHandler':
return $this->runtimes[$type] = new \Smarty\Runtime\DefaultPluginHandlerRuntime( return $this->runtimes[$type] = new DefaultPluginHandlerRuntime(
$this->getDefaultPluginHandlerFunc() $this->getDefaultPluginHandlerFunc()
); );
} }
@@ -2052,7 +2054,7 @@ class Smarty extends \Smarty\TemplateBase {
* @param array|string $modifiers modifier or list of modifiers * @param array|string $modifiers modifier or list of modifiers
* to add * to add
* *
* @return \Smarty|Template * @return Smarty
* @api Smarty::addDefaultModifiers() * @api Smarty::addDefaultModifiers()
* *
*/ */
@@ -2131,7 +2133,7 @@ class Smarty extends \Smarty\TemplateBase {
* @throws \Smarty\Exception * @throws \Smarty\Exception
*/ */
public function display($template = null, $cache_id = null, $compile_id = null) { 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();
} }
/** /**