php - Magento Magmi 的 hhvm nginx toString 服务器错误

标签 php magento nginx hhvm magmi

我正在尝试在 Magento 应用程序上运行 magmi 产品导入插件,该应用程序在其上具有 NGINX 和 HHVM 的 aws ec2 实例上运行。当我尝试在 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 文件吗?

可能导致 fatal error 的原因。它没有发生在我装有 Apache 的本地机器上。


更新

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

Xdebug Screen Shot

最佳答案

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

    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");
}
?>

关于php - Magento Magmi 的 hhvm nginx toString 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31077435/

相关文章:

javascript - addthis 使 magento 捆绑产品错误

php - Magento 或 Zend 是否缓存数据库连接字符串?

ssl - Nginx ssl 提供不同的索引文件

nginx lua redis cookie 未设置

javascript - 在数组中添加了很多 var javascript 并删除了已插入的特定数组

php - 插入或更新(如果存在)到 mysql 表中

php - 调用未定义的方法 mysqli::result()

php - 在 Codeigniter 中插入 ID 数组

.htaccess - Magento <IfVersion',可能拼写错误或由未包含在服务器配置中的模块定义

nginx - 当 php-fpm 和 nginx 为 200 时,php header 位置自动将 http_response_code 设置为 302?