Я застрял в проблеме, что я установил расширение PHP7 Inchoo для запуска моего сайта magento на php7. Чтобы избежать ошибок json, команда Inchoo переписала функцию jsonDecode () основного помощника в помощник Inchoo, но я так удивлен, что функция jsonDecode () основного помощника по-прежнему вызывается.
Can anyone help me out why inchoo's overwritten function not being called ?
Inchoo Overriding Core Helper...
local/Inchoo/PHP7/etc/config.xml find the config file for the inchoo module
<?xml version="1.0"?>
<config>
<modules>
<Inchoo_PHP7>
<version>2.1.1</version>
</Inchoo_PHP7>
</modules>
<global>
<helpers>
<core>
<rewrite>
<data>Inchoo_PHP7_Helper_Data</data>
</rewrite>
</core>
</helpers>
</global>
</config>
Overwritten jsonDecode() function...
local/Inchoo/PHP7/Helper/Data.php
<?php
class Inchoo_PHP7_Helper_Data extends Mage_Core_Helper_Data
{
/** @var string $_moduleName Compatibility for translations, and maybe other stuff which uses module names. */
protected $_moduleName = 'Mage_Core';
/**
* Decodes the given $encodedValue string which is encoded in the JSON format
*
* Overridden to prevent exceptions in json_decode
*
* @param string $encodedValue
* @param int $objectDecodeType
* @return mixed
* @throws Zend_Json_Exception
*/
public function jsonDecode($encodedValue, $objectDecodeType = Zend_Json::TYPE_ARRAY) {
switch (true) {
case (null === $encodedValue) : $encodedValue = 'null'; break;
case (true === $encodedValue) : $encodedValue = 'true'; break;
case (false === $encodedValue) : $encodedValue = 'false'; break;
case ('' === $encodedValue) : $encodedValue = '""'; break;
default : // do nothing
}
return Zend_Json::decode($encodedValue, $objectDecodeType);
}
}
Задача ещё не решена.
Других решений пока нет …