Hot answers tagged

73

It happens because in PHP 7 you need to clarify that you are going to call the $callback variable as a method (function). So, the original line of the code looks like the following (file app/code/core/Mage/Core/Model/Layout.php): $out .= $this->getBlock($callback[0])->$callback[1](); In order to make it work on the latest PHP version we need to ...


34

http://php.net/manual/de/migration70.incompatible.php https://wiki.php.net/rfc/uniform_variable_syntax Due to uniform variable syntax the code is now interpreted strictly from left to right. The line $params['object']->$params['method']($this->_file['tmp_name']); should be $params['object']->{$params['method']}($this->_file['tmp_name']); ...


29

Magento announced officially on January 20th, 2016, that CE and EE 2.0.1 officially support PHP 7.0.2. Magento Enterprise Edition and Community Edition 2.0.1 are now available and feature important security and functional updates, including official support for PHP7.0.2. Link: https://magento.com/blog/technical/new-magento-20-resources-and-support-...


26

If you are using the most recent version, M CE 1.9.2.2, there is an extension that will bring it to full PHP 7 compatibility: https://github.com/Inchoo/Inchoo_PHP7. (Disclaimer: I'm the author, though there is much help from the community.) It's also installable through Composer from http://packages.firegento.com/. All incompatibilities mentioned here are ...


25

If you want to run your Magento 1.x website on PHP7, you need to make some little tweaks in your some Magento 1.x files to make it work without any issues. Most of Magento code is still valid in PHP 7, there are few incompatibilities listed below: 1. Uniform Variable Syntax issues: 1.1 app/code/core/Mage/Core/Model/Layout.php:555 This file causes and ...


25

Before you install Magento 2, make sure your system meets or exceeds the following requirements: Required PHP extensions: PDO/MySQL mbstring mcrypt mhash simplexml curl gd2, ImageMagick 6.3.7 (or later) or both soap But for php 7.0 you must use next commands: sudo apt-get update sudo apt-get install php7.0-gd php7.0-mcrypt php7.0-curl php7.0-intl php7.0-...


23

Update - September 2017: Magento 2.2 now officially supports PHP 7.1, so that's the Magento version you should aim for from now on if PHP 7.1 is something you want or need on your platform. Original - October 2016: I am actually wondering if the DevDocs documentation is a mistake and maybe they meant PHP 7.0.10 instead of 7.1.0, that would make more sense ...


21

No idea about PHP7, but I would guess most of the stuff is still valid in PHP7, you can find more information in the blog of Matthias Geniar ext/mysql: despite it being a very old MySQL extension, I'd reckon it's still very widely used, but it's time everyone moved to pdo_mysql. set_magic_quotes_runtime and magic_quotes_runtime: it seems I've seen ...


16

Here is how to fix it: edit vendor/magento/module-sales/etc/webapi.xml line 112: - <route url="/V1/invoices/:id/void" method="POST"> + <route url="/V1/invoices/:id/voidInvoice" method="POST"> edit vendor/magento/module-sales/Block/Adminhtml/Order/Invoice/View.php line 242: - return $this->getUrl('sales/*/void', ['invoice_id' => $this-&...


13

Solution I've created a magento module to solve magento issues with totals calculation for php7. The issues I've experienced in particular were that taxes have been added twice to the grand total for pay with amazon module on the amazonpayments checkout page. Credits The answer provided by archigrafix in this post (https://magento.stackexchange.com/a/...


13

No comment on Magento 1, but Magento 2 did have some problems with class names like "String". It did not take long to fix, but it did not work out of the box. I expect that Magento 2 will be fixed, but it might not be fixed yet due to other priorities first.


13

How did you installed php7 ? What OS are you running? Are you using php-mod or php-fpm? If you are running ubuntu and you installed using PPA, then try this Check if mcrypt module is there: php -m | grep mcrypt If not then install mcrypt: sudo apt-get install php7.0-mcrypt Then enable the module: phpenmod mcrypt Then restart php.


13

Method 1: If you have boolean value 0 and 1 use default option class Magento\Config\Model\Config\Source\Yesno app/code/Vendor/Theme/view/adminhtml/ui_component/your_ui_grid.xml <column name="instock"> <argument name="data" xsi:type="array"> <item name="options" xsi:type="object">Magento\Config\Model\Config\Source\Yesno</...


12

Magento 1.x is not fully compatible with PHP 7, see: Is Magento ready for PHP 7? This specific bug can be fixed, by overriding Mage_Core_Model_Layout and change line 555 from: $out .= $this->getBlock($callback[0])->$callback[1](); to $out .= $this->getBlock($callback[0])->{$callback[1]}();


11

php bin/magento setup:install --backend-frontname="admin" --key="admin" --session-save="files" --db-host="localhost" --db-name="magento_2_db" --db-user="root" --db-password="root" --base-url="http://local.magento.com/" --base-url-secure="https://local.magento2.com/" --admin-user="admin" --admin-password="admin123" --admin-email="pramod.kharade@example.com" --...


10

Yes, it is possible to migrate 1.9.2.2 from PHP 5.5 to PHP 7. Its not officially supported yet but Inchoo has found the solution to this. They have developed Magento extension to make Magento compatible with PHP 7. http://inchoo.net/magento/its-alive/ As of now from Magento 1.9.3.7 PHP 7.0 and 7.1 are officially supported. PHP 7.2 support is not yet ...


10

It is almost ready. I tried running a clean Magento 1.9.2.1 with PHP 7 RC1, which resulted in an instant crash (fatal error) of Magento. After fixing this problem, everything seemed to be working, except the backend, which I was not able log in to. Later it turned out to be a session related problem which can be patched. Briefly: The fatal error can be ...


10

Thanks to @Nickool, I found out apache mod_rewrite was not enabled. So I ran: sudo a2enmod rewrite Added the following lines to my /etc/apache2/sites-available/my.host.com <Directory /var/www/html/m2> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all &...


10

We will describe a simple solution based on the Payment Restriction module, where MageWorx – a vendor name and Payment Restriction – a module name. First, you need to create a directory for the module: app/code/MageWorx/PaymentRestriction Then, add a registration file: app/code/MageWorx/PaymentRestriction/registration.php <?php /** * Copyright © ...


9

I really don't know if this will help in any way, but something to look into. It is possible that your collecttotals model order is ordering differently, and that tax is being ordered/applied after grand_total You can test if this is the issue as follows. (note this involves adjusting a core file to get some debug info, please do not try this on a live ...


9

No official information but this Github issue gives a hint: https://github.com/magento/magento2/issues/4070 alankent commented on 8 Apr Could you try 7.0.4? There are reports of something breaking with 7.0.5. Not sure who's fault, but 7.0.5 is behaving differently in a way that impacts Magento. ... Vinai commented on 9 Apr @alankent Same ...


9

There are two possibilities: The devdocs are wrong and PHP 7.1 is not supported The requirement in composer.json is wrong. Since Magento 2.1 was released before PHP 7.1, it is most likely option (2) and the requirement in composer.json has just not been updated yet. But you can ignore it and install Magento anyways, if you add the --ignore-platform-reqs ...


9

each() function is deprecated in php 7.2 so change this function to foreach() Change while (list($name, $value) = each($options)) { $this->setOption($name, $value); } To foreach ($options as $name => $value){ $this->setOption($name, $value); }


9

If you need to know detail about the following code then read the following: $resultRedirect->setPath('*/*/'); First * means current route and second * means current controller. Let me explain it in detail with example. Suppose you are submitting any form to http://example.com/someroute/somecontroller/someaction. Then in this case if you are using $...


8

On Magento 1.6.2 and PHP 7.0.2 I solved it this way: 1 - Created first a local config.xml: Copied /app/code/core/Mage/Sales/etc/config.xml into /app/code/local/Mage/Sales/etc/config.xml 2 - Changed it like this Now it calculates correctly:


8

Magento2 is ready for PHP 7. Adaptation of code to PHP7 was done and all changes are available in develop branch. See issue on GitHub Also, support of php 7 in Magento1 require backward incompatible changes and I think will be not supported officially.


8

Try this example: protected $resultJsonFactory; /** * @param Context $context * @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory */ public function __construct( Context $context, \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory ) { $this->resultJsonFactory = $resultJsonFactory; parent::...


7

There is a problem with how Magento is calculating order grand total, and applying the discounts. This is also stopping the Paypal express checkout, as the line items do not add up to the grand total with the discount. The problem seems to be that the Mage_Sales_Model_Config_Ordered::_compareTotals() is not working the same in PHP7 as PHP5, and uasort() is ...


7

Magento 2 does not support PHP 7.2 until version 2.3 which is not out yet (rumour is it'll be out by the end of 2018). So your only real option here is to downgrade to the latest supported version of PHP (check the DevDocs for your version of Magento: https://devdocs.magento.com/guides/v2.2/install-gde/prereq/prereq-overview.html#php). You could also ...


7

Yes, you can upgrade via admin as well, To run System Upgrade: Log in to the Magento Admin as an administrator. Click System > Tools > Web Setup Wizard. The following page displays. Click System Configuration. For more details visit upgrade via admin CLI upgrade : php bin/magento maintenance:enable composer require magento/product-community-edition 2.3.1 ...


Only top voted, non community-wiki answers of a minimum length are eligible