Skip to content

Instantly share code, notes, and snippets.

@drobinson
Created January 29, 2016 20:38
Show Gist options
  • Save drobinson/48fad2e76d10bd49ee82 to your computer and use it in GitHub Desktop.
Save drobinson/48fad2e76d10bd49ee82 to your computer and use it in GitHub Desktop.
Diff for PHP 7 support in Magento CE 1.9.2.3
diff --git a/app/code/core/Mage/Core/Model/Layout.php b/app/code/core/Mage/Core/Model/Layout.php
index cb9227b..f61a462 100644
--- a/app/code/core/Mage/Core/Model/Layout.php
+++ b/app/code/core/Mage/Core/Model/Layout.php
@@ -552,7 +552,7 @@ class Mage_Core_Model_Layout extends Varien_Simplexml_Config
$out = '';
if (!empty($this->_output)) {
foreach ($this->_output as $callback) {
- $out .= $this->getBlock($callback[0])->$callback[1]();
+ $out .= $this->getBlock($callback[0])->{$callback[1]}();
}
}
diff --git a/app/code/core/Mage/Core/Model/Resource/Session.php b/app/code/core/Mage/Core/Model/Resource/Session.php
index 1c827c0..945b88c 100644
--- a/app/code/core/Mage/Core/Model/Resource/Session.php
+++ b/app/code/core/Mage/Core/Model/Resource/Session.php
@@ -215,7 +215,7 @@ class Mage_Core_Model_Resource_Session implements Zend_Session_SaveHandler_Inter
$data = $this->_read->fetchOne($select, $bind);
- return $data;
+ return (string)$data;
}
/**
diff --git a/app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php b/app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php
index 8ea2c32..cf4df17 100644
--- a/app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php
+++ b/app/code/core/Mage/ImportExport/Model/Export/Entity/Customer.php
@@ -247,7 +247,7 @@ class Mage_ImportExport_Model_Export_Entity_Customer extends Mage_ImportExport_M
$data = $this->_attributeOverrides[$attribute->getAttributeCode()];
if (isset($data['options_method']) && method_exists($this, $data['options_method'])) {
- $data['filter_options'] = $this->$data['options_method']();
+ $data['filter_options'] = $this->{$data['options_method']}();
}
$attribute->addData($data);
}
diff --git a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php
index 10cab41..cac0b16 100644
--- a/app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php
+++ b/app/code/core/Mage/ImportExport/Model/Export/Entity/Product/Type/Abstract.php
@@ -96,7 +96,7 @@ abstract class Mage_ImportExport_Model_Export_Entity_Product_Type_Abstract
$data = $this->_attributeOverrides[$attribute->getAttributeCode()];
if (isset($data['options_method']) && method_exists($this, $data['options_method'])) {
- $data['filter_options'] = $this->$data['options_method']();
+ $data['filter_options'] = $this->{$data['options_method']}();
}
$attribute->addData($data);
diff --git a/app/code/core/Mage/ImportExport/Model/Import/Uploader.php b/app/code/core/Mage/ImportExport/Model/Import/Uploader.php
index 247022a..2d1a40e 100644
--- a/app/code/core/Mage/ImportExport/Model/Import/Uploader.php
+++ b/app/code/core/Mage/ImportExport/Model/Import/Uploader.php
@@ -132,7 +132,7 @@ class Mage_ImportExport_Model_Import_Uploader extends Mage_Core_Model_File_Uploa
//run validate callbacks
foreach ($this->_validateCallbacks as $params) {
if (is_object($params['object']) && method_exists($params['object'], $params['method'])) {
- $params['object']->$params['method']($filePath);
+ $params['object']->{$params['method']}($filePath);
}
}
}
diff --git a/app/code/core/Mage/Sales/etc/config.xml b/app/code/core/Mage/Sales/etc/config.xml
index d76eac1..58bd3ba 100644
--- a/app/code/core/Mage/Sales/etc/config.xml
+++ b/app/code/core/Mage/Sales/etc/config.xml
@@ -1218,7 +1218,7 @@
</subtotal>
<shipping>
<class>sales/quote_address_total_shipping</class>
- <after>subtotal,freeshipping,tax_subtotal</after>
+ <after>subtotal,freeshipping,tax_subtotal,msrp</after>
<before>grand_total</before>
</shipping>
<grand_total>
@@ -1227,6 +1227,7 @@
</grand_total>
<msrp>
<class>sales/quote_address_total_msrp</class>
+ <before>grand_total</before>
</msrp>
</totals>
<nominal_totals>
diff --git a/lib/Varien/File/Uploader.php b/lib/Varien/File/Uploader.php
index 1245003..640fca1 100644
--- a/lib/Varien/File/Uploader.php
+++ b/lib/Varien/File/Uploader.php
@@ -271,7 +271,7 @@ class Varien_File_Uploader
//run validate callbacks
foreach ($this->_validateCallbacks as $params) {
if (is_object($params['object']) && method_exists($params['object'], $params['method'])) {
- $params['object']->$params['method']($this->_file['tmp_name']);
+ $params['object']->{$params['method']}($this->_file['tmp_name']);
}
}
}
@drobinson
Copy link
Author

To find all occurrences of the AST order of operations issue (the "{}" changes) you can run this on the codebase root:

sudo grep -RE -e '->$.+.+' ./

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment