Using __autoload() is deprecated¶
Defining the __autoload() function used to be the way to create a autoloading mechanism for classes, traits, interfaces and enumerations. This was later replaced by the spl_autoload_register() function, which allows adding and removing autoloading functions. Ever since, creating the __autoload() function is reported as deprecated, and the function is not used since PHP 8.0.
PHP code¶
<?php
function __autoload() {}
?>
Before¶
PHP Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead
Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead
After¶
PHP Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead
Fatal error: __autoload() is no longer supported, use spl_autoload_register() instead
PHP version change¶
This behavior changed in 8.0
Error Messages¶
` __autoload() is no longer supported, use spl_autoload_register() instead <https://php-errors.readthedocs.io/en/latest/messages/__autoload%28%29-is-no-longer-supported%2C-use-spl_autoload_register%28%29-instead.html>`_