PHP Deprecated: Methods with the same name
I am getting an error saying
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; TSStatus has a deprecated constructor in C:\Program Files (x86)\Zend\Apache24\htdocs\viewer\modules\tsstatus\tsstatus.php on line 10
class TSStatus is line 10 plus at the bottom TSStatus shows
class TSStatus
{
private $_host;
private $_queryPort;
private $_serverDatas;
private $_channelDatas;
private $_userDatas;
private $_serverGroupFlags;
private $_channelGroupFlags;
private $_login;
private $_password;
private $_cacheFile;
private $_cacheTime;
private $_channelList;
private $_useCommand;
private $_javascriptName;
private $_socket;
public $imagePath;
public $showNicknameBox;
public $timeout;
public $hideEmptyChannels;
public $hideParentChannels;
public function TSStatus($host, $queryPort)
...
}
Solution 1:
As mentioned in the error, the official manual and the comments:
Replace
public function TSStatus($host, $queryPort)
with
public function __construct($host, $queryPort)