deprecated constructor in index.php

katinka / 2017-02-08 20:15:09   

Hi Vaska,

I've just upgraded to v2.1.4 and everything is running smoothly as far as I can see - thank you a thousand times for all your hard work on this!!

However, when I open my website now I get this at the top of the website (and subsequently on every subpage of the menu)

my site is

anne-schwarz.com">anne-schwarz.com

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Index has a deprecated constructor in /home2/anneschw/public_html/ndxzsite/plugin/plugin.index.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at /home2/anneschw/public_html/ndxzsite/plugin/plugin.index.php:12) in /home2/anneschw/public_html/index.php on line 166

when I refresh the page this message disappears. And comes back when I empty the cache.

It's pretty clear that this is a PHP related problem and it doesn't impact the functionality of my site but is there anything I can change/add in the index.php to resolve this?

Vaska A / 2017-02-08 20:33:30   

Those aren't critical, but they are annoying.

I have Indexhibit setup to suppress error messages like this but I think your host has something overriding in the php_ini. You *might* be able to handle this via the .htaccess file but I'm not sure. Ask your host what your options are...

The notice (which is not an error) is telling you that code needs to be updated in the future - but I can't change this because right now it has backwards capability.

Vaska A / 2017-02-08 20:36:33   

You might be able to put this in your index.php file on line 5 after error_reporting...

ini_set('display_errors', 'Off');

Let me know if it works.

katinka / 2017-02-08 20:42:27   

Thanks Vaska, issue resolved.
I just realised that there was still an old htaccess file floating around in the public_html after my host had upgraded me to PHP7. Got rid of it and now it's all working perfectly.

katinka / 2017-02-08 20:52:43   

Update: it wasn't the htaccess file.

However, putting that line of code in the index.php did the trick, by the looks of it.

Vaska A / 2017-02-08 20:55:43   

Ok. Thanks for doing that...now I'll add that to our code. ;)

This thread has been closed, thank you.