How to fix TestLink blank Page __autoload() is deprecated
How to fix TestLink blank Page
TestLink blank page can be displayed from various issues. Some common causes are as follows:
- Missing PHP Extensions.
- Deprecated PHP Functions.
- Database Connection Issues.
- File and Folder Permissions, etc.
Error Indications
The error “autoload() is deprecated” can be caused by a deprecated PHP function.
autoload() is deprecated
Indications: A blank page is displayed when you try to login.
Error displayed:
Deprecated: __autoload() is deprecated , use spl_autoload_register() instead in C:\xampp\htdocs\testlink\third_party\phpmailer\PHPMailerAutoload.php on line 45
The blank page is displayed when we log in to TestLink as shown below.
TestLink Blank Page
Sample screenshot of the error is shown below:
Fix
autoload() is Fall back to traditional autoload for old PHP versions @param string $classname The name of the class to load. You can replace the function with spl_autoload_register as shown in the below steps.
We need to register to autoload functions with spl_autoload_register, this is from PHP 5.3 onwards. This function registers any number of autoloaders, enabling for classes and interfaces to be automatically loaded if they are currently not defined. By registering autoloaders, PHP is given a last chance to load the class or interface before it fails with an error.
Locate PHP file
Locate the PHP file PHPMailerAutoload.php on your installation.
Deprecated Function
Modify the deprecated function as shown below:
function __autoload($classname) { PHPMailerAutoload($classname); } To
spl_autoload_register(function($class) { PHPMailerAutoload($classname); });
Stop/Start
Stop and Start the Apache server.
Verify Fix
Launch the TestLink login page and log in with valid credentials.
This will fix the error and TestLink UI will be displayed without any error.
Related Error on Linux
A similar kind of error of a blank white page displayed after login on Linux-based installations can be found at: