noiselabs / SmartyBundle

Smarty3 template engine bundle for Symfony
http://smartybundle.readthedocs.io/
GNU Lesser General Public License v3.0
51 stars 36 forks source link

BugFix for read in-memory cache #99

Closed im-bravo closed 2 years ago

im-bravo commented 2 years ago

I am getting the following error when invoking the smarty:compile command.

php bin/console smarty:compile
18:45:49 CRITICAL  [console] Error thrown while running command "smarty:compile". Message: "Illegal offset type in isset or empty" ["exception" => TypeError { …},"command" => "smarty:compile","message" => "Illegal offset type in isset or empty"]

In TemplateLoader.php line 77:

  Illegal offset type in isset or empty

smarty:compile [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<bundle>]

In the original code, some time the $name will be a object.

return $this->cache[$templateId] = (string) $file;

Base on this idea, the cache index should be $templateId. So we should read cache from memory by $templateId instead of $name.

vitorbrandao commented 2 years ago

Thank you for your contribution, @im-bravo! Approved.