2017-10-17 122 views
1

磁1.9.3移动到新的服务器有PHP版本7.0.23遗漏的类型错误:传递给Mage_Core_Model_Store_Group :: setWebsite(参数1)必须是Mage_Core_Model_Website的一个实例,空给出

我更新了我的Magento网站服务器到新的PHP版本,它现在7.0.23,在此之前,其工作正常,但现在给人的问题

致命错误:未捕获的类型错误:传递给Mage_Core_Model_Store_Group参数1 :: setWebsite()必须Mage_Core_Model_Website的实例,给空,叫做

enter image description here

我试过inchoo patch for php 7也没什么效果。 https://github.com/Inchoo/Inchoo_PHP7

+1

特别是该行返回'公共职能setWebsite(Mage_Core_Model_Website $网站)' - 接受'在PHP 7 null'将不得不宣布'$ website'为空(如'setWebsite(Mage_Core_Model_Website $ website = null)'.Inchoo补丁是否正确安装?Magento 1.9x实际上并不是PHP7兼容的。 – CD001

+0

是正确安装的补丁@ CD001 –

+0

@ CD001您的参考帮助了很多谢谢.. –

回答

1

我以上由@cd001

首先提到我更新文件app/code/core/Mage/Core/Model/Store/Group.php 在该方法试图我刚更换下面线

public function setWebsite(Mage_Core_Model_Website $website) 

public function setWebsite(Mage_Core_Model_Website $website = null) 

然后我得到另一个错误

Fatal error: Uncaught Error: Function name must be a string in 
app\code\core\Mage\Core\Model\Layout.php:555 Stack trace: #0 
app\code\core\Mage\Core\Controller\Varien\Action.php(390): Mage_Core_Model_Layout->getOutput() #1 
app\code\core\Mage\Cms\Helper\Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout() #2 
app\code\core\Mage\Cms\Helper\Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home') #3 
app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home') #4 
app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Cms_IndexController->indexAction() #5 
app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index') #6 
app\code\core\Mage\Core\Model\Layout.php on line 555 

对于我更新的文件app/code/core/Mage/Core/Model/Layout.php

在我替换下面一行

$out .= $this->getBlock($callback[0])->$callback[1](); 

$out .= $this->getBlock($callback[0])->{$callback[1]}(); 

,一切工作正常...

+0

我建议你在本地覆盖/模块中更新app/code/core/Mage/Core/Model/Store/Group.php当你更新你的Magento时,这个改变可能会丢失。 –

0

它看起来就像当前版本的Inchoo_PHP7一样与最新版本的Magento。阅读他们的版本说明https://github.com/Inchoo/Inchoo_PHP7/releases

我的早期版本的Inchoo_PHP7包含上述文件的所有修复程序。像这样的......

<core> 
    <rewrite> 
     <layout>Inchoo_PHP7_Model_Layout</layout> 
    </rewrite> 
</core> 
相关问题