Prestashop 致命错误:插件标签";“逃避”;已注册

Prestashop 致命错误:插件标签";“逃避”;已注册,prestashop,fatal-error,prestashop-1.7,Prestashop,Fatal Error,Prestashop 1.7,我试图为prestashop安装一个单页的chechout插件,但之后我立即出现了一个错误 误差500 我通过FTP删除了模块文件夹,并在prestashop上激活了DEBUG模式,现在我遇到了以下错误: 致命错误:未捕获-->Smarty:插件标记“escape”已存在 注册首先,您不应该从FTP中删除模块。它可以创建表、覆盖等,如果您将其从FTP中删除并且未正确卸载,这些表、覆盖等将保留 所以,一旦您恢复backoffice,您应该再次上传模块并从backoffice卸载它 检测是谁造成了错

我试图为prestashop安装一个单页的
chechout
插件,但之后我立即出现了一个错误

误差500

我通过FTP删除了模块文件夹,并在prestashop上激活了
DEBUG
模式,现在我遇到了以下错误:

致命错误:未捕获-->Smarty:插件标记“escape”已存在
注册首先,您不应该从FTP中删除模块。它可以创建表、覆盖等,如果您将其从FTP中删除并且未正确卸载,这些表、覆盖等将保留

所以,一旦您恢复backoffice,您应该再次上传模块并从backoffice卸载它

检测是谁造成了错误

Fatal error: Uncaught --> Smarty: Plugin tag "escape" already registered <-- thrown in /home/user/public_html/vendor/prestashop/smarty/sysplugins/smarty_internal_templatebase.php on line 449
一旦您知道是谁导致了错误,您必须在注册插件之前验证插件是否已经注册:

if (!isset($this->context->smarty->registered_plugins['function']['escape'])) {
    $this->context->smarty->registerPlugin('function', 'escape', array($lazyRegister, 'escape'));
}
编辑:

如果错误来自模块的插件标记
escapePTS
onepagecheckoutps,请替换以下行:

smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
从文件
/classes/OnePageCheckoutPSCore.php

与:

更改此项:

smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
为此:

if (!isset($smarty->registered_plugins['modifier']['escape'])) {
smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
}
我刚搬走

//CODE MODULES PRESTEAMSHOP - PLEASE NOT REMOVE
//--------------------------------------------------------------------------------------------------------
smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
function escapePTS($string, $esc_type = "html", $char_set = null, $double_encode = true, $as_html = false)
{
    $smarty_escape = SMARTY_PLUGINS_DIR."modifier.escape.php";
    include_once $smarty_escape;

    if (!$as_html && is_callable("smarty_modifier_escape")) {
        $string = call_user_func("smarty_modifier_escape", $string, $esc_type, $char_set, $double_encode);
    }

    return $string;
}
//--------------------------------------------------------------------------------------------------------
从文件/config/smarty.config.inc.php的末尾开始,现在它开始工作了。
但对我来说,模块安装未成功,模块未安装。

尝试清除Prestashop缓存以消除致命错误。高级参数->性能->通过管理面板清除缓存frontoffice或backoffice中出现错误500?@Alexander Grosul我试图清除缓存但未成功:(@idnovate它同时出现在FO和BO@Zebios我不确定此模块是否导致了此错误。我将编写一个产品来尝试检测错误并修复它谢谢您的响应,但您给我的代码生成了一个语法错误!!PHP解析错误:语法错误,意外的“public”(T\u public),应为/home/user/public_html/vendor/prestashop/smarty/sysplugins/smarty_internal_templatebase.php中的文件结尾861@Zebios您只需添加以下行
$e=newexception;var\u dump($e->getraceasstring());
在函数中。请比较此函数与您的函数之间的差异。非常感谢您的回答。我将代码添加到函数中,但它没有说明是谁真正导致了此问题。它给出了如下错误:
string(452)”\0/home/user/public\u html/config/smarty.config.inc.php(128):smarty\u Internal\u TemplateBase->registerPlugin('modifier','escape',Array)#1/home/user/public_html/config/smarty.config.inc.php(202):smartyRegisterFunction(对象(smarty),'modifier','escape','escapets')#2/home/user/public_html/config/config.inc.php(207):require_一次('/home/user/pu…)#3/home/user/public_html/admin/index.php(43):require('/home/user/pu…)#4{main}”
好的。请在
onepagecheckoutps
模块的所有文件中搜索
escapePTS
,并将出现的行粘贴到此处。哦,我知道!问题是文件
\u PS\u ROOT\u DIR.'/config/smarty.config.inc.php'
中的内容已经修改。然后您所做的修改无效。请编辑文件<代码>\u PS\u ROOT\u DIR.'/config/smarty.config.inc.php',搜索
smartyRegisterFunction($smarty,“修饰符”、“转义”、“转义”);
,并用我以前的代码替换它
smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
if (!isset($smarty->registered_plugins['modifier']['escape'])) {
smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
}
//CODE MODULES PRESTEAMSHOP - PLEASE NOT REMOVE
//--------------------------------------------------------------------------------------------------------
smartyRegisterFunction($smarty, "modifier", "escape", "escapePTS");
function escapePTS($string, $esc_type = "html", $char_set = null, $double_encode = true, $as_html = false)
{
    $smarty_escape = SMARTY_PLUGINS_DIR."modifier.escape.php";
    include_once $smarty_escape;

    if (!$as_html && is_callable("smarty_modifier_escape")) {
        $string = call_user_func("smarty_modifier_escape", $string, $esc_type, $char_set, $double_encode);
    }

    return $string;
}
//--------------------------------------------------------------------------------------------------------