문제

Magento 1.9.4 PHP 7에서는 실행되지 않으며 아래와 같은 오류가 표시됩니다 :

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
.

도움이 되었습니까?

해결책

PHP 7 메소드 (함수)로 bulter 변수를 호출 할 것이라는 것을 명확히해야하기 때문에 발생합니다.따라서 코드의 원래 줄은 다음과 같이 보입니다 (파일 $callback) :

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

최신 PHP 버전에서 작업하기 위해이 코드를이 코드를 대체해야합니다.

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

참조 이 블로그 자세한 내용은

다른 팁

PHP7에서 Magento 1.x 웹 사이트를 실행하려면 일부 마젠토 1.x 파일에서 문제없이 작동하도록 약간의 조정을해야합니다.

대부분의 Magento 코드는 PHP 7에서 여전히 유효하며 아래에 나열된 비 호환성이 거의 없습니다.

1. 균일 한 변수 구문 문제 :

1.1 앱 / 코드 / 코어 / 마법 / 코어 / 모델 / layout.php : 555

이 파일은 Magento를 충돌시키는이 파일과 치명적인 오류가 발생합니다. 파일을 무시하십시오

를 교체하십시오
$out .= $this->getBlock($callback[0])->$callback[1]();
.

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

1.2 App \ Code \ Core \ Mage \ ImportExport \ Model \ Import \ Uploader.php : 135

이 파일은 Magento CSV Importer입니다. 파일을 재정의 한 다음 _ValidateFile () 함수를 재정의하고 행 135를

를 교체하십시오
$params['object']->$params['method']($filePath);
.

$params['object']->{$params['method']}($filePath);
.

1.3 App \ Code \ Core \ Mage \ ImportExport \ Model \ Export \ Entity \ Product \ Type \ Abstract.php : 99

이 발행물은 마그네토의 기능을 내보낼 수 있습니다. Magento는 위의 추상 클래스에서 3 개의 클래스를 확장하므로 아래의 클래스 내부의 오류의 근본 원인은 위의 클래스에서 라인 # 99입니다.

mage_importexport_model_export_entity_product_type_configurable. mage_importexport_model_export_entity_product_type_grouped. mage_importexport_model_export_entity_product_type_simple

우리는 로컬 코드 풀에서 세 가지 클래스 이상을 무시하고 overrideAttribute () 함수를 무시하고, 라인 # 99

을 교체해야합니다.
$data['filter_options'] = $this->$data['options_method']();
.

$data['filter_options'] = $this->{$data['options_method']}();
.

1.4 App \ Code \ Core \ Mage \ ImportExport \ Model \ Export \ Entity \ Customer.php : 250

이 파일은 고객 기능을 내보내줍니다. 위의 파일을 재정의하고 아래 그림과 같이 라인 # 250을 변경하십시오

$data['filter_options'] = $this->$data['options_method']();
.

$data['filter_options'] = $this->{$data['options_method']}();
.

1.5 lib \ varien \ file \ uploader.php : 259

파일 업로드가 작동하지 않습니다. Magento는 위의 클래스에서 mage_core_model_file_uploader를 확장 하므로이 클래스를 무시하고 다시 작성 _ValidateFile () 함수가 아래 줄 바꾸기

$params['object']->$params['method']($this->_file['tmp_name']);
.

$params['object']->{$params['method']}($this->_file['tmp_name']);
.

2. 유형 캐스팅 문제

2.1 app \ code \ core \ mage \ core \ model \ resource \ session.php : 218

Magento 세션은 PHP 7에서 작동하지 않으므로 결과 사용자 로그인이 작동하지 않습니다. 읽기 ($ SESSID) 함수는 문자열을 반환해야하므로 반환 변수를 아래로 표시합니다

return $data;
.

return (string)$data;
.

3. 그랜드 총계

잘못된 합계는 잘못된 정렬 순서로 인한 것입니다. 확장자를 만들고 확장자의 config.xml에 코드를 입력하여 정렬 순서를 수정하십시오

<global>
    <sales>
        <quote>
            <totals>
                <msrp>
                    <before>grand_total</before>
                </msrp>
                <shipping>
                    <after>subtotal,freeshipping,tax_subtotal,msrp</after>
                </shipping>
            </totals>
        </quote>
    </sales>
</global>
.

위에 게시 된 내용에 대한 원래 참조는 다음과 같습니다. http://scriptbaker.com/tag/magento-1-9/

코드에서 쿼리를 찾을 수 없으면 Magento가 보험 적용 할 것이고 내가 전에 말했듯이 대부분의 코드가 유효하므로 무시할 수 있습니다. 나는 모든 것이 당신의 질문에 답할 수 있다고 믿습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top