문제

PHP 7은 베타 상태에 도달했으며 현재 많은 테스트가 진행 중입니다.Magento가 작년에 "PHP 5.3에서만 실행"에서 "PHP 5.6과 완벽하게 호환 가능"까지 따라잡았다는 점을 감안할 때, Magento 1.x 및 Magento 2에 대한 PHP 7 호환성을 얼마나 고려하고 있는지 알고 싶습니다.

나는 찾았다 Anna Filina의 이 게시물 그녀는 Magento 1.9.1에서 한 가지 문제를 발견했지만(1.9.2에서는 여전히 변경되지 않음) Magento 1에 단위 테스트가 없으므로 이것이 유일한 문제라고는 믿지 않습니다.

질문은 다음과 같습니다.Magento 1에 대한 PHP 7 호환성이 보장됩니까?그리고 Magento 2는 이미 PHP 7에서 테스트되었으므로(자동 테스트에 감사드립니다!) 알려진 문제가 있습니까?

도움이 되었습니까?

해결책

Magento는 2016 년 1 월 20 일에 공식적으로 발표되었으며, CE 및 EE 2.0.1은 공식적으로 PHP 7.0.2를 지원합니다.

Magento Enterprise Edition 및 Community Edition 2.0.1 이제 중요한 보안 및 기능 업데이트를 사용할 수 있고 기능을 제공합니다. PHP7.0.2에 대한 공식 지원을 포함하여

링크 : https://magento.com/blog/technical/new.-MAGENTO-20 자원 및 지원 -PP7

다른 팁

PHP7에 대해서는 전혀 모르지만 대부분의 내용은 PHP7에서도 여전히 유효할 것 같습니다. 자세한 내용은 다음 블로그에서 찾을 수 있습니다. 마티아스 지니아르

  • 내선/mysql: 아주 오래된 MySQL 확장임에도 불구하고 여전히 널리 사용되고 있다고 생각합니다. 하지만 이제는 모두가 pdo_mysql로 ​​옮겨야 할 때입니다.
  • set_magic_quotes_runtime 그리고 magic_quotes_runtime: 이후로 이러한 지원 중단 공지를 본 것 같습니다.영원히?
  • iconv.input_encoding, iconv.output_encoding: 지금까지 저는 이런 기능을 사용해 본 적이 없습니다...
  • # ini 파일의 스타일 주석: 일관성 만세, 저는 항상 선호했습니다.(세미콜론)은 .ini 파일의 주석입니다!
  • preg_replace() 평가 수정자: 보안에 관심이 있는 시스템 관리자를 위한 만세!

내 생각에 우리가 Magento에서 가질 수 있는 유일한 것은 preg_replace() 평가 수정자 하지만 그렇지 않기를 바랍니다.

이 외에도 Magento는 업데이트된 TAF와 함께 1.9.2를 출시했습니다. dev에서 찾을 수 있습니다.이를 통해 PHP7에서 여러 프런트엔드 테스트를 실행하고 나중에 로그를 검사할 수 있습니다.

Magento 1에 대한 의견은 없지만 Magento 2는 "String"과 같은 클래스 이름에 몇 가지 문제가있었습니다.고치기에는 오래 걸리지 않았지만 상자에서 잘 작동하지 않았습니다.Magento 2가 고정 될 것으로 기대하지만 다른 우선 순위로 인해 아직 고정되지 않을 수도 있습니다.

거의 준비가 되었습니다.나는 PHP 7 RC1을 사용하여 깨끗한 Magento 1.9.2.1을 실행하려고 시도했는데, 그 결과 Magento가 즉시 중단되었습니다(치명적인 오류).이 문제를 해결한 후에는 로그인할 수 없는 백엔드를 제외하고는 모든 것이 작동하는 것 같았습니다.나중에 패치가 가능한 세션 관련 문제인 것으로 밝혀졌습니다.

간단히:

  1. 치명적인 오류는 재정의하여 수정할 수 있습니다. Mage_Core_Model_Layout 그런 다음 555행을 다음에서 변경합니다.
    $out .= $this->getBlock($callback[0])->$callback[1]();
    ~ 안으로
    $out .= $this->getBlock($callback[0])->{$callback[1]}();

  2. 세션 문제는 재정의하여 일시적으로 해결할 수 있습니다. Mage_Core_Model_Session_Abstract_Varien 그리고 다시 작성 getData, setData, unsetData, addFullNames 방법, 그래서 어디에서나 $this->_data 사용되었으므로 다음으로 교체됩니다. $_SESSION.

누군가가 솔루션에 관심이 있다면 찾을 수 있습니다. 여기.

Magento2는 PHP 7을위한 준비가되어 있습니다. PHP7에 코드 적응이 완료되었으며 모든 변경 사항은 지점 개발에서 사용할 수 있습니다. github

또한 Magento1의 PHP 7의 지원은 뒤로 양립 할 수없는 변화가 필요하며 공식적으로 지원되지 않을 것이라고 생각합니다.

Magento가 주문을 계산하고 할인을 적용하는 방법에 문제가 있습니다.또한 PayPal Express Checkout을 중지하고 있으며, 라인 항목은 할인으로 그랜드 총계에 합계를 추가하지 않으므로

PHP5와 같은 PHP7에서 PHP7에서 동일하게 작동하지 않는 것으로 보이는 것처럼 보입니다.

사용법 : -

protected function _getSortedCollectorCodes()
{
    if (Mage::app()->useCache('config')) {
        $cachedData = Mage::app()->loadCache($this->_collectorsCacheKey);
        if ($cachedData) {
            return unserialize($cachedData);
        }
    }
    $configArray = $this->_modelsConfig;
    // invoke simple sorting if the first element contains the "sort_order" key
    reset($configArray);
    $element = current($configArray);
    if (isset($element['sort_order'])) {
        uasort($configArray, array($this, '_compareSortOrder'));
    } else {
        foreach ($configArray as $code => $data) {
            foreach ($data['before'] as $beforeCode) {
                if (!isset($configArray[$beforeCode])) {
                    continue;
                }
                $configArray[$code]['before'] = array_unique(array_merge(
                    $configArray[$code]['before'], $configArray[$beforeCode]['before']
                ));
                $configArray[$beforeCode]['after'] = array_merge(
                    $configArray[$beforeCode]['after'], array($code), $data['after']
                );
                $configArray[$beforeCode]['after'] = array_unique($configArray[$beforeCode]['after']);
            }
            foreach ($data['after'] as $afterCode) {
                if (!isset($configArray[$afterCode])) {
                    continue;
                }
                $configArray[$code]['after'] = array_unique(array_merge(
                    $configArray[$code]['after'], $configArray[$afterCode]['after']
                ));
                $configArray[$afterCode]['before'] = array_merge(
                    $configArray[$afterCode]['before'], array($code), $data['before']
                );
                $configArray[$afterCode]['before'] = array_unique($configArray[$afterCode]['before']);
            }
        }
        foreach ($configArray as $code => $data) {
           $largest_small = $smallest_large = 0;
           foreach ($data['after'] as $afterCode) {
              if(isset($configArray[$afterCode]['sort_order']) && $largest_small < $configArray[$afterCode]['sort_order'])
                 $largest_small = $configArray[$afterCode]['sort_order'];
           }
           foreach ($data['before'] as $beforeCode) {
              if(isset($configArray[$beforeCode]['sort_order']) && ($smallest_large == 0 || $configArray[$beforeCode]['sort_order'] < $smallest_large)) 
                 $smallest_large = $configArray[$beforeCode]['sort_order'];
           }
           if($smallest_large <= $largest_small+1){
              if($smallest_large == 0) $smallest_large = $largest_small+1;
              $add = $largest_small+2-$smallest_large;
              foreach ($configArray as $code1 => $data1) {
                 if(!isset($data1['sort_order'])) break;
                 if($smallest_large <= $data1['sort_order'])
                    $configArray[$code1]['sort_order'] += $add;
               }
           }
           $configArray[$code]['sort_order'] = $largest_small+1;
        }
        uasort($configArray, array($this, '_compareSortOrder'));
    }
    $sortedCollectors = array_keys($configArray);
    if (Mage::app()->useCache('config')) {
        Mage::app()->saveCache(serialize($sortedCollectors), $this->_collectorsCacheKey, array(
                Mage_Core_Model_Config::CACHE_TAG
            )
        );
    }
    return $sortedCollectors;
}
.

Magento PHP7 비 호환성에 대해 공유하고 싶은 내 연구입니다. 현재 균일 한 변수 구문으로 인해 코드가 실패 해야하는 장소를 찾았습니다.

파일 : 앱 / 코드 / 코어 / Mage / ImportExport / 모델 / 내보내기 / 엔티티 / 제품 / 유형 / Abstract.php

방법 : overrideAttribute

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

파일 : 앱 / 코드 / 코어 / 마법사 / ImportExport / 모델 / 내보내기 / 엔티티 / customer.php

방법 : FilterAttributeCollection

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

파일 : 앱 / 코드 / 코어 / Mage / ImportExport / model / import / uploader.php

방법 : _ValidateFile

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

파일 : 앱 / 코드 / 코어 / 마법사 / 카탈로그 / 모델 / 제품 / 링크 / API / v2.php

방법 : 할당

if (isset($data->$attribute['code'])) {
    $links[(int)$linkedProductId][$attribute['code']] = $data->$attribute['code'];
}
.

파일 : 앱 / 코드 / 코어 / 마법사 / 카탈로그 / 모델 / 제품 / 링크 / API / v2.php

방법 : 업데이트

$data->$attribute['code']
.

file : lib / varien / file / uploader.php

방법 : _ValidateFile

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

파일 : 앱 / 코드 / 코어 / 마법사 / 코어 / 모델 / layout.php

방법 : getOutput

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

Magento 1과 관련된 다른 답변 외에도 :

PHP 7 Zend_XmlRpc_Server의 비 호환성은 Zend Framework 1.12.12

에서 고정되었습니다.

모든 버전 이전의 CE 1.9.2.2 / EE 1.14.2.2 이전 버전의 Zend 프레임 워크를 사용하여 Magento의 XML-RPC API를 사용하는 경우 문제가 발생할 수 있습니다.

PHP 7과 호환되는 M1을 구성한 M1으로 변경된 인치 파일을 확인하십시오. 이는 몇 개의 파일이지만 Inchoo의 지능형 작업입니다. https://github.com/inchoo/inchoo_php7/tree./ 마스터 / 앱 / 코드 / 로컬 / inchoo / php7

Magento 2 CE 버전 2.1.4를 사용하고 있습니다.

magento \ app \ bootstrap.php

if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50005 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
    if (PHP_SAPI == 'cli') {
        echo 'Magento supports PHP 5.6.5, 7.0.2, 7.0.4 and 7.0.6 or later. ' .
            'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
    } else {
        echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <p>Magento supports PHP 5.6.5, 7.0.2, 7.0.4 and 7.0.6 or later. Please read
    <a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
    Magento System Requirements</a>.
</div>
HTML;
    }
    exit(1);
}
.

짧은 대답은 아니요, 그렇지 않습니다.Magento CE 1.9.2.4는 공식적으로 PHP 5.4 및 5.5 만 지원합니다.PHP 5.6이 괜찮아지는 동안, 그것은 다중 사용자의 경고 메시지가있는 로그 파일을 포화시킵니다.

긴 대답은 지원 PHP7을 실행하기 위해이를 수정하는 것이 상대적으로 쉽습니다.그러나 많은 확장은 여전히 PHP7 호환이 아닙니다. 그래서 당신은 대부분 당신 자신의 것입니다.

PHP 7.0은 2018년 12월 첫째 주부터 지원이 종료됩니다.

이 게시물을 기준으로 현재 버전의 Magento 2.2.3(2018년 2월 20일 릴리스)은 PHP 7.1 또는 PHP 7.2를 지원하지 않습니다.

확인하여 지원되는 버전을 확인할 수 있습니다. app/bootstrap.php Magento 설치 폴더에서 다음과 유사한 코드를 찾으세요.

/* PHP version validation */
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
    if (PHP_SAPI == 'cli') {
        echo 'Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. ' .
            'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
    } else {
        echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
    <p>Magento supports PHP 7.0.2, 7.0.4, and 7.0.6 or later. Please read
    <a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
    Magento System Requirements</a>.
</div>
HTML;
    }
    exit(1);
}

에도 문제가 있는 것 같습니다. .htaccess Apache 2.4에서는 500 오류가 발생합니다.

또한 포함된 작성기 파일에는 php5.5에 대한 종속성만 포함되어 있습니다.

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