cancel
Showing results for 
Search instead for 
Did you mean: 

Can´t run Magento 1.9.4.0 on PHP 7.2 using Mage::app()

Can´t run Magento 1.9.4.0 on PHP 7.2 using Mage::app()

Recently I have upgraded Magento 1.9.3.9 using SUPEE patches to the 1.9.4.0 level, which should be already PHP 7.2 compatible. Magento frontend and backend is running good, but my good old script outside not.

These are some scripts for exporting products to XML feeds, where Magento is being instantiated using traditional aproach like:

require_once $basefolder . 'app/Mage.php';
umask(0);
Mage::app(1);

Getting then:

Deprecated: __autoload() is deprecated, use spl_autoload_register() instead in /app/code/core/Mage/Core/functions.php on line 60

and also

Fatal Error Uncaught Mage_Core_Model_Store_Exception in /mnt/data/accounts/f/foltynwine/data/www/foltynwine.cz/app/code/core/Mage/Core/Model/App.php:1377

On PHP 7.1 and 7.0 my scripts are working. Any idea please?

Stanislav Puffler, DiS.
ecommerce specialist at Open Mage
----------------------------------------------------
www.OpenMage.cz
tel. +420 773 565 747
Komenskeho 696/8, 435 11 Lom
2 REPLIES 2

Re: Can´t run Magento 1.9.4.0 on PHP 7.2 using Mage::app()

Hello @Open Mage ,

 

 

__autoload is generally considered obsolete. It only allows for a single autoloader. Generally you should only use __autoload if you're using a version of PHP without support for spl_autoload_register.

 

spl_autoload_register allows several autoloaders to be registered which will be run through in turn until a matching class/interface/trait is found and loaded, or until all autoloading options have been exhausted. This means that if you're using framework code or other third party libraries that implement their own autoloaders you don't have to worry about yours causing conflicts.

 

Can you please try to change __autoload function to spl_autoload_register after clear cache and remove var directory 

 /app/code/core/Mage/Core/functions.php on line 60

 

--

if issue solved, please Accept as Solution & give Kudos

Re: Can´t run Magento 1.9.4.0 on PHP 7.2 using Mage::app()

Sorry, I do not want to change anything in core files. Anyway there is a notice from Magento team for the discussed method * @todo change to spl_autoload_register, so I hope it will be resolved in some next M1 version. No problem for now, it is "only depracated".

 

The main issue for now is the second one mentioned ... FATAL ERROR with Uncaught Mage_Core_Model_Store_Exception. This one breaks the script...

Stanislav Puffler, DiS.
ecommerce specialist at Open Mage
----------------------------------------------------
www.OpenMage.cz
tel. +420 773 565 747
Komenskeho 696/8, 435 11 Lom