Firefox PHP

Phorum 5.2 and php7

Posted by pat 
pat
Phorum 5.2 and php7
September 13, 2018 08:45PM
Hi, will phorum work with php7?
Re: Phorum 5.2 and php7
June 20, 2019 12:34AM
I am experimenting with PHP 7.3.6 and it's working, although I'm finding a few problems and warnings...

First off, in the admin.php under Global Settings

"Censor List" causes badwords.php to throw this warning:
Quote

PHP warning: Use of undefined constant string - assumed 'string' (this will throw an Error in a future version of PHP)

PHP warning generated at /var/www/html/phorum/include/admin/badwords.php:173

Back trace:

Function include_once called at
{path to Phorum}/admin.php:108


"Cache Settings" does not work at all, and throws this warning:

Quote

PHP warning: count(): Parameter must be an array or an object that implements Countable

PHP warning generated at /var/www/html/phorum/include/admin/PhorumInputForm.php:211

Back trace:

Function show called at
{path to Phorum}/include/admin/mods.php:146
----
Function include_once called at
{path to Phorum}/admin.php:108

Same warning from:
Quote

Function show called at
{path to Phorum}/mods/event_logging/settings/logviewer.php:209
----
Function include called at
{path to Phorum}/mods/event_logging/settings.php:54
----
Function include_once called at
{path to Phorum}/include/admin/modsettings.php:29

and

Function show called at
{path to Phorum}/include/admin/users.php:451


Then, logged in to the main phorum, and went to Recent messages:
Quote

PHP warning: Illegal string offset 'cache_version'

PHP warning generated at /var/www/html/phorum/mods/recent_messages/recent_messages.php:252

Back trace:

Function phorum_mod_recent_messages_addon called at
{path to Phorum}/common.php:1887
----
Function phorum_hook called at
{path to Phorum}/addon.php:140


Made a post successfully but got this notice:
Quote

PHP notice: A non well formed numeric value encountered

PHP notice generated at /var/www/html/phorum/include/upload_functions.php:113

Back trace:

Function phorum_phpcfgsize2bytes called at
{path to Phorum}/include/upload_functions.php:36
----
Function phorum_get_system_max_upload called at
{path to Phorum}/posting.php:625

...
Steve Healy, Phorum hacker, currently on: (version 5.2.19)
contributions:
Birthdays mod, Top Users mod, Icon legend.tpl, (plus a handful of bugfixes and old 5.0 creations)
Re: Phorum 5.2 and php7
October 20, 2019 04:52PM
Hello,
I am testing my 5.2.22 installation, that used to run on PHP 5.6, on PHP 7.2

I have done just some very simple tests on the main operations:
- login
- change my password
- post
- reply
- save general settings in admin
and a few others.

I haven't see, so far, any evident problem. I also see warnings, but I saw warnings even on PHP 5.6 and it's hard to say if the warnings compromise the correct functioning of the program without analyzing the related code line by line.

Does anyone know something more about this? Should we trust the use of phorum 5.2.22 on PHP 7.2?

Thanks!

Best,
Re: Phorum 5.2 and php7
February 12, 2020 09:57PM
version 5.2.20 PHP: 7.3.14


Cache Settings - not work
Database Integrity - not work


What to do?
Re: Phorum 5.2 and php7
February 22, 2020 05:58AM
My server just got updated tonight to PHP 7 and all I can see is the header. Everything after that is gone! My entire site is built on phorum so it's a major issue. Anyone having any luck getting things running with PHP7?


Jake Morgan

www.PULLOFF.com
Independent Pulling News
Re: Phorum 5.2 and php7
May 02, 2020 03:09PM
Is anyone working on updating Phorum so it works cleanly with php 7? I have been using phorum since the early 2000's and have kept up-to-date whenever possible. My hosting server just went to php 7. While the basic functionality seems ok, I have started seeing warnings. As php continues to evolve, this probably will get worse.
Re: Phorum 5.2 and php7
May 02, 2020 07:17PM
Hi,

Same question for me: how to make Phorum work with PHP 7.3?

And do you know if there are differences between PHP 7.0, 7.1, 7.2 and 7.3 for Phorum 5.2.20?

Thanks :)

Cactus : [www.cactuspro.com]
Re: Phorum 5.2 and php7
May 02, 2020 08:33PM
I am working on this in my spare time testing with php 7.4.x. on Win 8.1
The different versions of the php 7.x are not all the same, they moved or squashed some bugs.
............Different OS's appear to cause subtle differences (they should not).

About line 108 in include / upload_functions . php

Language: PHP
function phorum_phpcfgsize2bytes($val) { $val = trim($val); $last = strtolower($val{strlen($val)-1});   switch($last) {

add " $val = (int)$val; "
Language: PHP
function phorum_phpcfgsize2bytes($val) { $val = trim($val); $last = strtolower($val{strlen($val)-1}); $val = (int)$val;   switch($last) {
Re: Phorum 5.2 and php7
May 03, 2020 08:27AM
In the admin...

General Settings, scroll near the bottom. Select / click a ? to display a help message box.
If the help popup message box does not center on the page, and you find it at the top left of the page...

include/admin/header . php
About line # 81 locate the following line and comment it out.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[www.w3.org];
like below
// <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[www.w3.org];
Verify the help is now centered on the page.

*Note the comment slashes are displayed at the top left of the page, if nothing else breaks I will fix this.

This issue may be browser dependent. I had the problem in an older Firefox version 56.0.
The current Brave browser has the issue. (Chrome based)
IE 11 has the issue.



Edited 3 time(s). Last edit at 05/03/2020 04:51PM by Scott Finegan.
Re: Phorum 5.2 and php7
May 04, 2020 01:21AM
1) Aren't HTML comments <!-- --> instead of // ? This line is not within the <?php .... ?> code.

2) When running admin-> edit users I received the following error:

"Warning: count(): Parameter must be an array or an object that implements Countable in /home/wlyanceu/public_html/phorum5/include/admin/PhorumInputForm.php on line 213"

This is a class definition for PhorumInputForm and frankly is beyond my current php skills. Any thoughts?
Re: Phorum 5.2 and php7
May 04, 2020 02:38AM
I modified include/admin/PhpInputForm.php line 40 from:

var $_help;

to

var $_help = array(); /*Added to get rid of php7 warning*/

This seems to fix the warning and help tips seem to be added normally when I run the various functions. This is consistent with the warning, as count() now seems to require an explicitly defined countable element rather than inferring the type from an undefined declaration. PHP7.2 seems to be a bit tighter than earlier versions, which actually is a good thing, as it prevents unintended effects. Note that there is an addhelp method for this class invoked at various places that fills the $_help array with tooltip help text for various functions, and it seems to work after the change.
Re: Phorum 5.2 and php7
May 04, 2020 03:00AM
The bad words problem has two problems. One is listed above (undefined "string" constant) in Steve Healy's earlier post. However, if the bad words list is empty, it gives a countable error similar to the $_help problem in my previous post. I have to play with these.
Re: Phorum 5.2 and php7
May 04, 2020 08:24AM
.

1) You are right about HTML comments, however browsers look for the Doctype at the top of the document even though it is commented out. Browsers behave differently, depending on what brand and when it was made. Took me a while to figure out it was the Doctype messing it up.
The page does need a Doctype of some kind, something for another day.
I was interested in fixing the problem so testing each of the settings is easier. The slashes are printed, reminding me to return to the issue ;)

2) My thought is: " if(count($this->_help)){ " // is only a True or False test, the count is never saved or used.
The behavior was changed in 7.2 , and now may require several tests isset(), empty(), to cover all possibilities.
I used " if(!empty($this->_help)){ "
Re: Phorum 5.2 and php7
May 04, 2020 01:00PM
I think I have fixed the badwords.php problems

1) The count() warning I received for an empty bad words list was solved by Scott Finegan's suggestion:

replace
if(count($bad_words)){
on or about line 157 with
if(!empty($bad_words)){

2) The 'Censor List' problem described by Steve Healy above was solved by changing the line

echo " <td class=\"".$ta_class."\">".htmlspecialchars($item[string])."</td>\n";

on or about line 173 to:

echo " <td class=\"".$ta_class."\">".htmlspecialchars($item['string'])."</td>\n";

Note the single quotes around (string) - Although it looks like a single valued variable, $item is actually an array, and the literal 'string' is just the key value for one of the elements. Incidentally, this is a good example of how it can get confusing to use a common keyword as an index key:)

3) I did not encounter Steve Healy's problem with cache. However, note that the warning being shown was with the show() method, which we fixed as described in previous posts.

4) I didn't see the recent messages mod in my mods list, and my phorum (5.2.23) doesn't have it in the mods directory. Can I get this somewhere?



Edited 2 time(s). Last edit at 05/04/2020 01:36PM by jbaker.
Re: Phorum 5.2 and php7
May 04, 2020 02:31PM
Recent Messages is available here [www.phorum.org]

You need to either add the Mod Jumpmenu [www.phorum.org], or edit the template to show the link.


List of Modules here ---> https://www.phorum.org/modules.php
Re: Phorum 5.2 and php7
May 04, 2020 03:32PM
Thank you.
Sorry, only registered users may post in this forum.

Click here to login