MagentoはPHP 7の準備ができていますか?
-
13-12-2019 - |
質問
PHP 7はベータ地位に達しており、現時点ではたくさんのテストが進行中です。Magentoが「PHP 5.3の「PHP 5.3」から「完全に互換性がある」まで、Magento 1.xとMagento 2の互換性を考慮していることを知りたいのです。
解決
Magentoは、2016年1月20日に正式に発表され、CEとEE 2.0.1はPHP 7.0.2を正式に支援しています。
Magento Enterprise EditionとCommunity Edition 2.0.1は現在 利用可能で機能の重要なセキュリティと機能の更新、 PHP7.0.2の公式サポートを含む
link: https://magento.com/blog/technical/new.-MAGENTO-20-Resources-And-Support-PHP7
他のヒント
最新バージョンを使用している場合は、M CE 1.9.2.2を使用している場合は、それをフルPHP 7互換性にもたらす拡張機能があります。https://github.com/inchoo/inchoo_php7 。(免責事項:私は著者ですが、コミュニティからの助けがありますが。)
それはまた、 http://packages.firegento.com/ からの作曲家を通してインストール可能です。
ここで言及したすべての非互換性は固定されています。まだいくつかのエッジケースがあるかもしれませんが、何も表示されません。テスト、レポート作成およびプルリクエストは大歓迎です。
PHP7についてはわかりませんが、私はPHP7でもほとんどのものが有効であると思います。
Magento 1にコメントがありませんが、Magento 2は「文字列」のようなクラス名に問題がありました。修正するには時間がかかりませんでしたが、箱から出してはいけませんでした。Magento 2が固定されることを期待していますが、最初に他の優先順位のためにまだ固定されないかもしれません。
ほぼ準備ができています。PHP 7 RC1でクリーンマージェント1.9.2.1を実行しました。これによりマゼントの即時クラッシュ(致命的なエラー)が発生しました。この問題を修正した後、私がログインできなかったバックエンドを除いて、すべてが働いているようでした。後でパッチを適用することができるセッション関連の問題であることがわかりました。
簡単に:
-
致命的なエラーは、
Mage_Core_Model_Layout
をオーバーライドすることによって固定され、次に行555を変更します。$out .= $this->getBlock($callback[0])->$callback[1]();
$out .= $this->getBlock($callback[0])->{$callback[1]}();
-
セッションの問題は、
Mage_Core_Model_Session_Abstract_Varien
、getData
、setData
、unsetData
メソッドを上書きして一時的に固定できます。誰かが解決策に興味がある場合は、こちら
Magento2はPHP 7の準備ができています.COD7へのコードの適応が行われ、すべての変更が開発ブランチで入手可能です。 github
また、Magento1でのPHP 7のサポートは後退不適合な変更を必要とし、正式にはサポートされないと思います。
マゼントの順位ground totalをどのように計算しており、割引を適用しているかに問題があります。ラインアイテムが割引で壮大な合計に追加されていないので、これはPayPal Expressチェックアウトを停止しています。
PHP5とPHP7と同じようにMage_Sales_Model_Config_Ordered::_compareTotals()
が動作していないという問題があるように、uasort()
は順序付けの推移的な関係に依存していますが、これは注文合計のためのものである必要はありません。
を使ってみてください: -
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 /モデル/エクスポート/ entity / product / type / abstract.php
方法:オーバーライディアテート
$data['filter_options'] = $this->$data['options_method']();
.
ファイル:アプリ/コード/コア/ MAGE / ImportExport /モデル/エクスポート/ entity / customer.php
方法:FilterAttributeCollection
$data['filter_options'] = $this->$data['options_method']();
.
ファイル:アプリ/コード/コア/ MAGE / ImportExport / Model / Import / Uploader.php
メソッド:_validateFile
$params['object']->$params['method']($filePath);
.
ファイル:アプリ/コード/コア/ MAGE /カタログ/モデル/製品/リンク/ API / v2.php
方法:
の割り当てif (isset($data->$attribute['code'])) {
$links[(int)$linkedProductId][$attribute['code']] = $data->$attribute['code'];
}
.
ファイル:アプリ/コード/コア/ MAGE /カタログ/モデル/製品/リンク/ API / v2.php
メソッド:更新
$data->$attribute['code']
.
ファイル:lib / varien / file / uploader.php
メソッド:_validateFile
$params['object']->$params['method']($this->_file['tmp_name']);
.
ファイル:アプリ/コード/コア/ MAGE / CORE / MODEL / LAYOUT.PHP
メソッド:getOutput
$out .= $this->getBlock($callback[0])->$callback[1]();
. PHP 7と互換性のあるM1に変更されたInchoOからのファイルの確認PHP 7と互換性のあるものは、いくつかのファイルではマイナーな変更ですが、Inchooからのインテリジェントな作業です。 https://github.com/inchoo/inchoo_php7/tree./マスター/アプリ/コード/ローカル/ Inchoo / PHP7
Magento 2 CEバージョン2.1.4を使用しています&Fine。
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をサポートしていません。
Magento Installフォルダのapp/bootstrap.php
を確認し、次のようなコードを探すことで、サポートされているバージョンを確認できます。
/* 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);
}
.
Apache 2.4で500個のエラーを引き起こす.htaccess
でも問題があるようです。
さらに、Composerファイルには、PHP5.5
の依存関係のみが含まれています。