Some older templates problem with php 7.2.13

Please post the URLs to pages, where you've made a CMSimple template available for download

Moderator: mikey

Post Reply
Nicky
Posts: 136
Joined: Sun Feb 08, 2009 9:50 am
Location: Antwerp

Some older templates problem with php 7.2.13

Post by Nicky » Tue Feb 12, 2019 6:36 pm

I'm looking at/testing some of OldNema's templates. Some of them I used for a few clients. Most templates work fine with php7.2.13 and the latest cmsimple version, however one of them 'ferrariclub' is completely blocked..

There are a significant number of php errors. It seems that something is wrong in the combination of the template and the "xtoc menu", more specifically the vertical one.

Now, unfortunately I don't understand much of php programming, but is is weird that the 'pizza' template, which also uses 'xtoc', but in the horizontal form, has no problems at all.

I'm worried because I used the "Ferrari template" for a client, so as soon as the hosting provider stops with older php version, website is 'gone'. And that's a website of significant size..

Is there an 'easy' solution within the community?

Take a look:
Working fine : https://walhalles.be/pizza/

Big trouble here : https://walhalles.be/ferrari

Thanks in advance for your time.

Grtz

cmb
Posts: 13211
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Some older templates problem with php 7.2.13

Post by cmb » Tue Feb 12, 2019 8:08 pm

Nicky wrote:
Tue Feb 12, 2019 6:36 pm
There are a significant number of php errors. It seems that something is wrong in the combination of the template and the "xtoc menu", more specifically the vertical one.
The fix should be as simple as replacing line 14 of xtoc.php with:

Code: Select all

function xtoc($start = null, $end = null) {global $c, $cl, $s, $l, $cf;$ta = array();if (isset($start)) {if (!isset($end))$end = $start;}else $start = 1;if (!isset($end))$end = $cf['menu']['levels'];$ta = array();if ($s > -1) {$tl = $l[$s];for($i = $s; $i > -1; $i--) {	if ($l[$i] <= $tl && $l[$i] >= $start && $l[$i] <= $end)if(!hide($i))$ta[] = $i;if ($l[$i] < $tl)$tl = $l[$i];}@sort($ta);$tl = $l[$s];}else $tl = 0;$tl += 1+$cf['menu']['levelcatch'];for($i = $s+1; $i < $cl; $i++) {if ($l[$i] <= $tl && $l[$i] >= $start && $l[$i] <= $end)if(!hide($i))$ta[] = $i;	if ($l[$i] < $tl)$tl = $l[$i];}return xli($ta, $start);}
Christoph M. Becker – Plugins for CMSimple_XH

Nicky
Posts: 136
Joined: Sun Feb 08, 2009 9:50 am
Location: Antwerp

Re: Some older templates problem with php 7.2.13

Post by Nicky » Tue Feb 12, 2019 9:42 pm

OMG, this works!
Chapeau pour les ingenieurs, grand respect.

cmb
Posts: 13211
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Some older templates problem with php 7.2.13

Post by cmb » Tue Feb 12, 2019 10:46 pm

Nicky wrote:
Tue Feb 12, 2019 9:42 pm
OMG, this works!
Fine. :)

Note that this problem exists as of PHP 7.1.0 (not only PHP 7.2.13), and all existing templates with this potential issue should be fixed, even if they're running on an older PHP version yet. The fix above is compatible with whatever PHP version xtoc is compatible (at least PHP 5.0.0).

Note to self: promote Toxic_XH to GA as soon as possible, since it could be used as replacement for xtoc, keeping such updates in a single place (instead of potentially having to fix all existing templates using xtoc).
Christoph M. Becker – Plugins for CMSimple_XH

Nicky
Posts: 136
Joined: Sun Feb 08, 2009 9:50 am
Location: Antwerp

Re: Some older templates problem with php 7.2.13

Post by Nicky » Fri Feb 15, 2019 5:27 pm

Still a small warning as follows:

XH-DEPRECATED: Function editmenu() is deprecated
/home/walhalles/domains/walhalles.be/public_html/ferrari/templates/ferrariclub/template.htm:45

However, everything works fine, so that should not be a problem?

cmb
Posts: 13211
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Some older templates problem with php 7.2.13

Post by cmb » Fri Feb 15, 2019 5:39 pm

Nicky wrote:
Fri Feb 15, 2019 5:27 pm
Still a small warning as follows:

XH-DEPRECATED: Function editmenu() is deprecated
/home/walhalles/domains/walhalles.be/public_html/ferrari/templates/ferrariclub/template.htm:45

However, everything works fine, so that should not be a problem?
No, that's not an immediate problem, but since editmenu() does nothing as of CMSimple_XH 1.5, I suggest that you simply delete line 45 of template.htm.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply