How to fix blank page TestLink __autoload() is deprecated, use spl_autoload_register()
Error Indications
autoload() is deprecated
Indications: A blank page is displayed when you try to login to TestLink UI __autoload() is deprecated.
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.
Error Blank Page
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 login with valid credentials.
This will fix the error and TestLink UI would be displayed without any error.
More Information
More information can be found at:
http://php.net/manual/en/language.oop5.autoload.php
Related Error on Linux Installation
A similar kind off error of blank white page displayed after TestLink login on Linux based installations can be found at:
https://www.testingdocs.com/questions/how-to-fix-testlink-blank-page-error-on-linux/
TestLink Tutorial on this website can be found at:
https://www.testingdocs.com/testlink-tutorials/