系统相关
首页 > 系统相关> > php – hhvm nginx toString服务器错误与Magento Magmi

php – hhvm nginx toString服务器错误与Magento Magmi

作者:互联网

我正在尝试在一个运行在具有NGINX&的aws ec2实例的Magento应用程序上运行magmi产品导入插件. HHVM就可以了.当我尝试在Magento上运行magmi产品导入应用程序时,我的hhvm错误日志中出现以下服务器错误.

/var/log/hhvm/error.log

\nCatchable fatal error: Object of class Magmi_ProductImportEngine could not be converted to string in /var/www/qa-hoi/magmi-importer/inc/magmi_mixin.php on line 9

这是magmi_mixin.php文件

<?php
class Magmi_Mixin
{
    protected $_callers;

    public function bind($caller)
    {
        $this->_callers[]=$caller;
        $this->_callers=array_unique($this->_callers);  // LINE 9   
    }

    public function unbind($caller)
    {

        $ks=array_keys($this->_callers,$caller);
        if(count($ks)>0)
        {
            foreach($ks as $k)
            {   
                unset($this->_callers[$k]);
            }
        }

    }

    public function __call($data,$arg)
    {
        if(substr($data,0,8)=="_caller_")
        {
            $data=substr($data,8);
        }
        for($i=0;$i<count($this->_callers);$i++)
        {
            if(method_exists($this->_callers[$i],$data))
            {
              return call_user_func_array(array($this->_callers[$i],$data), $arg);
            }
            else
            {
                die("Invalid Method Call: $data - Not found in Caller");
            }
        }
    }
}

知道如何解决这个问题吗?我应该更新我的php.ini文件吗?

什么可能导致致命的错误.它不会发生在我的本地机器上,它有Apache.

UPDATE

我在本地机器上安装了HHVM并运行了xdebug.似乎magmi文件中的$caller对象包含几个无法计算的数组.见下面的截图:

解决方法:

我遇到过同样的问题.我的解决方案是简单地注释掉违规行.

    public function bind($caller)
{
    $this->_callers[]=$caller;
    // $this->_callers=array_unique($this->_callers);  // LINE 9   
}

您可能还会发现Magmi在/magmi/web/magmi_run.php上收到“500 hphp_invoke”错误.为了解决这个问题,我在第一个if语句中添加了一个异常处理程序.我的magmi_run.php文件现在读取…

<?php
$params = $_REQUEST;
ini_set("display_errors", 1);
require_once ("../inc/magmi_defs.php");
require_once ("../inc/magmi_statemanager.php");
try {
    $engdef = explode(":", $params["engine"]);
    $engine_name = $engdef[0];
    $engine_class = $engdef[1];
    require_once ("../engines/$engine_name.php");
} catch (Exception $e) {
    die("ERROR");
}
if (Magmi_StateManager::getState() !== "running") {
    try {
        Magmi_StateManager::setState("idle");
        $pf = Magmi_StateManager::getProgressFile(true);
        if (file_exists($pf)) {
            @unlink($pf);
        }
        set_time_limit(0);
        $mmi_imp = new $engine_class();
        $logfile = isset($params["logfile"]) ? $params["logfile"] : null;
        if (isset($logfile) && $logfile != "") {
            $fname = Magmi_StateManager::getStateDir() . DIRSEP . $logfile;
            if (file_exists($fname)) {
                 @unlink($fname);
            }
            $mmi_imp->setLogger(new FileLogger($fname));
        } else {
            $mmi_imp->setLogger(new EchoLogger());
        }
        $mmi_imp->run($params);
    } catch (Exception $e) {
        die("ERROR");
    }
} else {
    die("RUNNING");
}
?>

标签:nginx,php,magento,hhvm,magmi
来源: https://codeday.me/bug/20190623/1273554.html