News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Problems with PHP 8.1

Started by dendemeier, July 14, 2022, 02:59:06 AM

Previous topic - Next topic

dendemeier

Last week I upgraded my forum to 2.0.19. Since then I set up the php-version in the server´s control Panel to 8.1, but now there are many mistakes in the error log.

The most common one is:

8192: preg_replace_callback(): Passing null to parameter #3 ($subject) of type array|string is deprecated
File: /home/prlxboxf/public_html/forum/Sources/Load.php
Line: 178

The code in Load.php is as following:



// Set a list of common functions.
175: $ent_list = empty($modSettings['disableEntityCheck']) ? '&(?>#\d{1,7}|quot|amp|lt|gt|nbsp);' : '&(?>#021|quot|amp|lt|gt|nbsp);';
176: $ent_check = empty($modSettings['disableEntityCheck']) ? function($string, $double = false)
177: {
178: $string = preg_replace_callback('~(&' . (!empty($double) ? '(?:amp;)?' : '') . '#(\d{1,7}|x[0-9a-fA-F]{1,6});)~', 'entity_fix__callback', $string);
179: return $string;
180: } : function($string)
181: {
182: return $string;
183: };


Is there a workaround to solve this?

Also with PHP 8.1 the e-mail for resetting a password isn´t send to a user. With 7.4. it´s working. But i don´t know if the error is responsible for it or if this i an other problem.


For now I switched back to PHP 7.4. But there is also an error. Priority is to get the forum work with php 8.1. But if this doesn´t work, I want to get rid of this mistake as well.

8192: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence
File: /home/prlxboxf/public_html/forum/Sources/Subs-InlineAttachmentsAdmin.php
Line: 296

Code:

// Set up for the "we're not done" message:
$context['sub_template'] = 'not_done';
$context['substep_enabled'] = true;
$context['substep_continue_percent'] = floor(($count / $max) * 100);
$context['continue_percent'] = floor( ( (($step - 1) / (count($tags) * 2)) + ($context['substep_continue_percent'] * (1 / count($tags) * 2)) ) * 100);
$context['continue_get_data'] = 'action=admin;area=manageattachments;sa=ila;continue';
$context['continue_post_data'] = '
<input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
<input type="hidden" name="' . ($ascending ? 'ascend' : 'descend') . '" value="1" />
<input type="hidden" name="count1" value="' . $count . '" />
<input type="hidden" name="count2" value="' . $context['ila_completed'] + ($count - $start). '" />
<input type="hidden" name="pms" value="' . ((int) $table == 'personal_messages') . '" />';
$context['continue_countdown'] = 5;
return false;
}

The error is shown for line $context['continue_post_data'] = '

Thanks in advance :)

d3vcho

Hi,

As per this, SMF 2.0.19 does not currently support PHP 8.1.
"Greeting Death as an old friend, they departed this life as equals"

dendemeier

Ah, alright. I didn´t see that. Thanks :)

I switched back to php 8.0, but the forum isn´t working at all. So I´m staing at 7.4.


Is there a solution for an error which is shown under php 7.4?


8192: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence
File: /home/prlxboxf/public_html/forum/Sources/Subs-InlineAttachmentsAdmin.php
Line: 296

Code:

// Set up for the "we're not done" message:
                $context['sub_template'] = 'not_done';
                $context['substep_enabled'] = true;
                $context['substep_continue_percent'] = floor(($count / $max) * 100);
                $context['continue_percent'] = floor( ( (($step - 1) / (count($tags) * 2)) + ($context['substep_continue_percent'] * (1 / count($tags) * 2)) ) * 100);
                $context['continue_get_data'] = 'action=admin;area=manageattachments;sa=ila;continue';
                $context['continue_post_data'] = '
            <input type="hidden" name="' . $context['session_var'] . '" value="' . $context['session_id'] . '" />
            <input type="hidden" name="' . ($ascending ? 'ascend' : 'descend') . '" value="1" />
            <input type="hidden" name="count1" value="' . $count . '" />
            <input type="hidden" name="count2" value="' . $context['ila_completed'] + ($count - $start). '" />
            <input type="hidden" name="pms" value="' . ((int) $table == 'personal_messages') . '" />';
                $context['continue_countdown'] = 5;
                return false;
            }

The error is shown for line
$context['continue_post_data'] = '

Dzonny

Are you using any mods, if so which ones?
Any reason why you're not upgrading to 2.1 branch though? :)

dendemeier

I´m using several mods:

dQuote Selection and Notification 2,7,6
Event Registration Mod for SMF2 2,36
Spoiler BBCode 1,1,3
Advanced Recent posts 1,1,1
mention members 1,1,2
Alternate User Postung 1,0,1
Anti-Spam by Cleantalk 2,36
Recent Forum Topics Boardindex 1,2
Birthday on Profile Summary v2 2,1
Top First Post 2,0,6
Discord Web Hooks 2,0,1
Ohara YouTube Embed 1,2,13
Post Scheduler 1,0,1

But the error appears only when entering the admin-area.


And for this:

Quote from: Dzonny on July 14, 2022, 04:57:37 AMAny reason why you're not upgrading to 2.1 branch though? :)

Yes. The main reason is that the theme of the forum isn´t compatible with 2.1. I´m using "Gaming Nation" from SMF Tricks and we want to switch to "Darkly", also from SMF Tricks and for now it is unclear, if they will update their themes to 2.1.

So for now i´m sticking with 2.0.19

Kindred

Since inline attachments is not a feature in 2.0.x, that file is from a mod -- which may not be compatible with php 7.4
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

dendemeier

Ah, maybe it was a file from an attachement mod. I renamend the file, now everything works perfectly. Thank you :)

Arantor

Renaming files is always a bad idea, it just means you broke the mod.

Diego Andrés

Indeed something is wrong if you don't have it installed anymore (according to your list of installed mods).

The current person supporting that mod is very active so you should definitely bring this into the support topic: https://www.simplemachines.org/community/index.php?topic=525705.0
I assume it's that mod.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Gandrel

Quote from: d3vcho on July 14, 2022, 03:04:07 AMHi,

As per this, SMF 2.0.19 does not currently support PHP 8.1.

Hmm, does 2.0.19 really not support PHP 8.1 and if so, is the 2.0.19 announcement somewhat misleading where it says "Ensures compatibility with PHP 8.1 MySQLi error mode"? Link to the announcement here

Aleksi "Lex" Kilpinen

2.0.19 fully supports PHP 5.3 - 8.0. ( Devs, do correct me if I'm wrong here. )
There may be changes in 2.0 code aimed at partial support or future proofing, but officially the version requirements for each 2.0 release are listed at https://wiki.simplemachines.org/smf/SMF2.0:Requirements_and_recommendations
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Steve

3 months with no feedback? Marking solved.
DO NOT pm me for support!

Advertisement: