codeigniter Message: __autoload() is deprecated, use spl_autoload_register() instead

A CI application was returning me the following error, after the PHP been updated to 7.3.

I had to change a few lines at config/config.php

function __autoload($class)
{
	if(strpos($class, 'CI_') !== 0)
 	{
  		@include_once( APPPATH . 'core/'. $class . EXT );
 	}
}

to

spl_autoload_register(function($class) {
     @include_once ( APPPATH . 'core/'. $class . EXT );
 });

2 thoughts on “codeigniter Message: __autoload() is deprecated, use spl_autoload_register() instead

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.