Hhvm nginx toString error with Magento Magmi

I am trying to run the magmi product import plugin in a Magento application that runs on an aws ec2 instance that has NGINX and HHVM on it. When I try to run the magmi product import application on Magento, I get an error below the server in my hhvm error log .

/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

This is magmi_mixin.php file

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

Any idea how I should solve this? Should I update the php.ini file?

Which can cause a fatal error. This does not happen on my local Apache machine.


UPDATE

I installed HHVM on my local machine and ran xdebug. It seems that the object $callerin the magmi file contains several arrays that cannot be evaluated. See screenshot below:

Xdebug Screen Shot

+4
2

. , .

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

, Magmi "500 hphp_invoke" /magmi/web/magmi _run.php. , 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");
}
?>
+3

HHVM , PHP, , , , ( ) PHP, HHVM.

:

HHVM, , # 9, array_unique (. http://docs.hhvm.com/manual/en/function.array-unique.php):

array_unique($this->_callers)

HHVM :

function array_unique ( array $array [, int $sort_flags = SORT_STRING ] ): array

, , array_unique , SORT_STRING, , , .

, ( ) "" __toString().

, Magmi_ProductImportEngine, - :

class Magmi_ProductImportEngine /* extends whatever */ {
     // ... other stuff

     public function __toString() {
         return 'array representation of the object as string for sorting purposes';
     }

     // ... other stuff
}
, , Apache mod-php ( " PHP Catchable: Magmi_ProductImportEngine " ) , Apache "$ this → _ callers" Magmi_ProductImportEngine ?
+1

All Articles