Page 1 of 1

PHP 7

Posted: Sat Mar 19, 2016 6:59 am
by Tata
I have tried to change the PHP version in my webspace from v5.5 to v 7 and loading a webpage I got the warning:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; XH_CSRFProtection has a deprecated constructor in /www/c/m/u13296/public_html/_sub/funnytree/cmsimple/classes/CSRFProtection.php on line 28...

So I went back to v 5.6. Shouldn't it be revised on older webpages and change thing with some patches?

Re: PHP 7

Posted: Sat Mar 19, 2016 8:54 am
by cmb
Tata wrote:Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; XH_CSRFProtection has a deprecated constructor
The message does not currently point at an error in the code, but rather points out that there will be a problem in a future version, which is most likely to be PHP 8. There is plenty of time until PHP 8 will be released, so we have plenty of time to fix the issue.

While it would be possible to fix the deprecation notice and let the code still work for PHP 4, I don't think it makes sense to do so. Instead I still prefer to drop support for PHP 4 altogether in the next version of CMSimple_XH (i.e. 1.7)[1], where this issue will be resolved in a clean way.

Anyhow, there's no real problem to use CMSimple_XH 1.6.7 with PHP 7.0.x, and most likely not with 7.1.x.

[1] Well, actually I would prefer that we had dropped PHP 4 support long ago.

Re: PHP 7

Posted: Sat Mar 19, 2016 9:06 am
by Tata
Fine. So I probably update my webspace for a use of PHP7?

Re: PHP 7

Posted: Sat Mar 19, 2016 10:28 am
by cmb
Tata wrote:Fine. So I probably update my webspace for a use of PHP7?
If there are no problems with any plugins you are using or are planning to use, I suggest you do so. For instance, PHP 7 removed the regex extension by default, and a lot of old plugins use ereg*(), what would break the site.

Re: PHP 7

Posted: Sat Mar 19, 2016 6:57 pm
by Tata
Well, so far no problems. But I haven't checked all websites running in my webspace. I will test them this week, hopefully.

Re: PHP 7

Posted: Sat Mar 19, 2016 8:04 pm
by Tata
Well, but after upgrading to PHP v7, the warbing
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; XH_CSRFProtection has a deprecated constructor in /www/c/m/u13296/public_html/_sub/funnytree/cmsimple/classes/CSRFProtection.php on line 28...
is back.
Where and how shall I switch the warning OFF? It would be nice to have some PHP script to be able to hide the warnings in "visitor" mode and keep it optional in "edit" mode.

Re: PHP 7

Posted: Sun Mar 20, 2016 12:26 pm
by cmb
Tata wrote:Where and how shall I switch the warning OFF? It would be nice to have some PHP script to be able to hide the warnings in "visitor" mode and keep it optional in "edit" mode.
That is exactly how the debug mode is supposed to work. :?

Re: PHP 7

Posted: Sun Mar 20, 2016 10:00 pm
by Michael_G
Hi Tata,

set the debug level in the _XHdebug.txt from 6 (?) to 3 to get only messages when a real issue will occur. :mrgreen: