Skip to Content
It is currently January 28th, 2022, 8:34 pm

All times are UTC - 6 hours [ DST ]

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: October 11th, 2021, 3:42 pm 
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8299
Location: Cologne (Germany)
PHP 8 is almost 1 year old now, so I think it's time to think about an upgrade.
I won't help with adjusting the old templates from SAM 4.7.3 and older, but if you already upgraded to SAM 2018.3, updating the templates is an easy fix.

Basically the only thing remaining to be changed is the use of while(list($x,$y) = each($z)).
That was never a great style to use, but it was legal until PHP 7.2 and was still tolerated in PHP 7.3/7.4, but you did get a deprecation warning in those versions.
It looks like the code for SAM's PHP template was written by 2 different persons, one who knew PHP and one who had no clue what they were doing and just copied a tutorial from PHP3 or even older (that technique was outdated already when SAM was released 20 years ago and even more so when they released their rebranded templates 10 years ago)

The fix is replacing all occurences of the above pattern (variable names will vary slightly throughout the code) with foreach($z as $x => $y).
Usually these are accompanied with a reset($z) in front.

There's one in code/code.playlist.php, one in code/classes/ and several in library\Common\form.php and library\Common\xml.php:

Without replacing these, the templates will not be able to start a database connection and show an error message.
If you forget to fix the files in /code, the search function won't work, but it should be fine otherwise.

Attached is a zip file containing an updated samPHPweb folder with the PHP8 compatible templates. I removed the config folder, so if you didn't make any changes to the templates themselves, you should be able to unzip this file on top of your PHP files without having to change anything. (your database and other config will remain untouched)

File comment: samPHPweb updated for PHP8, Overwrite your own files, does not include the config directory!!! [281.58 KiB]
Downloaded 161 times

Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode
Reply with quote  
PostPosted: December 9th, 2021, 6:51 pm 
New User
New User

Joined: December 9th, 2021, 6:44 pm
Posts: 1
I would like to retain your services to get our request situation worked out. What is the best way to reach you?

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours [ DST ]

Who is online

Users browsing this forum: No registered users and 6 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group