cancel
Showing results for 
Search instead for 
Did you mean: 

PHP Deprecated: __autoload() is deprecated

PHP Deprecated: __autoload() is deprecated

Hello Friends,

I am a geek have done my website and it was working fine, i tried to login to my Backend admin panel and to my website both are not working, contacted my hosting guys, they forwarded me this:

 

 

 

[16-Apr-2021 01:40:02 UTC] PHP Deprecated:  __autoload() is deprecated, use spl_autoload_register() instead in /home/_/public_html/app/code/core/Mage/Core/functions.php on line 60

[16-Apr-2021 01:40:02 UTC] PHP Deprecated:  Function get_magic_quotes_gpc() is deprecated in /home/_/public_html/app/code/core/Mage/Core/functions.php on line 32

[16-Apr-2021 01:40:02 UTC] PHP Deprecated:  Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/_/public_html/app/Mage.php on line 721

 

 

please help i am unfamiliar with this

 

thanks

5 REPLIES 5

Re: PHP Deprecated: __autoload() is deprecated

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

__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.

 

Re: PHP Deprecated: __autoload() is deprecated

thanks for your time, 

i have tweaked the file,, but no luck,,,still it is showing the domain parked page

there are 2 more noted below in:

 

[16-Apr-2021 01:40:02 UTC] PHP Deprecated:  __autoload() is deprecated, use spl_autoload_register() instead in /home/myid/public_html/app/code/core/Mage/Core/functions.php on line 60  >> done

 

[16-Apr-2021 01:40:02 UTC] PHP Deprecated:  Function get_magic_quotes_gpc() is deprecated in /home/myid/public_html/app/code/core/Mage/Core/functions.php on line 32

 

[16-Apr-2021 01:40:02 UTC] PHP Deprecated:  Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in /home/myid/public_html/app/Mage.php on line 721

 

these above two i couldnt get thru

 

this is the page shown here below

 

eror page.jpg

 

 

Re: PHP Deprecated: __autoload() is deprecated

I am also having the same issue.  It is an old version because I am not familiar with Magento so the client has not requested any updates.  But the site is now down.

 

I changed the PHP version to 7.3, as I can see on Google 7.4 is not compatible.

 

If I change:

function __autoload($class)

to 

spl_autoload_register($class)

and try and log into the back end I get a constant reload state.

 

When I try to load the main website I get the same. The site constantly tries to reload but never achieves it!

 

What I do not understand is why it just started doing this now. The site has not changed, so the other possible reason is that the server updated to PHP 7.4.  But in theory putting it back to 7.3 should resolve it.

 

Eeeekkkkk   Help please !?!

 

 

Re: PHP Deprecated: __autoload() is deprecated

You should replace in line 60:

 

function __autoload($class)

to
function __spl_autoload_register($class)

It works for me :-)

Re: PHP Deprecated: __autoload() is deprecated

The __autoload deprecation error indicates your hosting updated to a newer PHP version that Magento 1 no longer supports. To fix this, you should:

- Upgrade to latest Magento 1.9.4.2 - handles __autoload correctly

- Migrate to Magento 2 - fully supports modern PHP versions

- Editing core files to replace __autoload is not recommended

upgrade your Magento version to maintain compatibility with your hosting's new PHP version and avoid autoload errors. Magento 1.9.4.2 or migrating to Magento 2 are the best options.