Magneto 1.9.3 已迁移到 PHP 版本 7.0.23 的新服务器
我将 Magento 网站服务器更新为新的 PHP 版本;现在是 7.0.23,但在此之前它工作正常。现在它给了我这个错误:
Fatal error: Uncaught TypeError: Argument 1 passed to Mage_Core_Model_Store_Group::setWebsite() must be an instance of Mage_Core_Model_Website, null given, called in
我也尝试了 php 7 的 inhoo patch,但没有任何效果。 https://github.com/Inchoo/Inchoo_PHP7
最佳答案
我尝试了@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]}();
现在一切正常。
关于php - 未捕获的类型错误:传递给 Mage_Core_Model_Store_Group::setWebsite() 的参数 1 必须是 Mage_Core_Model_Website 的实例,给定 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46785667/