Issue
After upgrading PHP from 5.4 to 7.0 following warning is displayed:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Pages has a deprecated constructor in /home4/webmaster/public_html/website/classes/pages.class.php on line 16
Resolution
The warning can be hidden by setting display_errors to Off in php.ini. Obviously this just hides the issue so a proper fix here is to fix the class in question.
Open the file mentioned in the warring message and find the constructor method. It should look something like this:
function Pages($id) {
...
}
Replace it with a constructor in the following format:
function __construct($id) {
...
}
You may also need keep the old constructor (if something in your website or application relies on it). Make sure it is placed below the new constructor:
function __construct($id) {
...
}
function Pages($id) {
self::__construct();
}
January 2016
PHP 7.0
Leave a Reply