Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: a10 on December 28, 2021, 09:14:34 AM

Title: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: a10 on December 28, 2021, 09:14:34 AM
2.0.19, supposed to work with 8 & 8.1? Errors normal or some mod?
(btw, no problem, am back to 7.4)

A  zillion:
Call to undefined function shell_exec()

A few:
8192: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
File: /customers/*/httpd.www/forum/Sources/Load.php
Line: 2250

------------------------

...and slightly related, a mystery, when on 8\8.1 discovered a constant hammering from bot\crawler 154.54.249.208 crawl-prodd4-16.babbar.eu (as it was producing tons of shell_exec error) while it accessed all posts in sequence. But the ip was nowhere to be seen in who's online, only in the error log. & does not show in who's online with php 7.4 either.

Perplexed by those phantom visits, am used to see many bots now and then but always showing up with some ip. Now blocked in htaccess, but any explanation for that ip's who's online invisibility?

Thanks
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: Shambles on December 28, 2021, 09:50:19 AM
For your zillion errors:  https://www.simplemachines.org/community/index.php?topic=577544.msg4103554#msg4103554
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: shawnb61 on December 28, 2021, 10:14:56 AM
First, the two issues...  I suspect they are related.  Some hosts have disabled shell_exec().  If you cannot enable it somehow, try disabling host name lookups in the ACP.  Some folks have reported that this resolves this issue.

Regarding php 8.0/8.1...  Tough question; we do not officially support 8.x.  Note that php 7.4 support brought us most of the way towards 8.0 compliance in 2.0.18.  All *known* 8.0 issues have been addressed in 2.0.19.  There have been some significant rewrites in 8.1, and this has created some problems with postgresql support.

All *known* 8.1 issues with mysql environments have been addressed.  Pg doesn't work at all, so we cannot say we support 8.1.

We have fallen short of claiming official support for php 8.x, mainly due to lack of testing coverage.  We are not all there yet.  But the current understanding is spelled out above.

(As an fyi...  I run 8.1 in my test mysql environments, and 8.0 in my test pg environments.  My only issues are with dev tools in 8.1 - it's all quite new and the tools I use don't even play nicely together yet.  I run 7.4 in prod 2.0.19.)
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: Kindred on December 28, 2021, 11:31:57 AM
actually, I can confirm the 8.0 issue.
(update done by patch from 2.0.18)

Call to undefined function shell_exec()
displayed on every screen.

Shifting back to 7.4, the following errors are in the error log.
Call to undefined function create_function()

/index.template.php - Line: 112
    2: Undefined array key "show_pm_popup"
        var smf_charset = "', $context['character_set'], '";', $context['show_pm_popup'] ? '
/index.template.php - Line: 265
    2: Undefined array key "random_news_line"
                    <p>', $context['random_news_line'], '</p>';
/index.template.php - Line: 411
    2: Undefined array key "menu_buttons"
    foreach ($context['menu_buttons'] as $act => $button)/index.template.php - Line: 411
    2: foreach() argument must be of type array|object, null given


and in Ant's Mutant Curve -- same errors plus this one
Ants_Mutant_Curve_1/index.template.php - Line: 592
    2: Undefined array key "allow_pm"
    if ($context['allow_pm'] && $context['user']['unread_messages'] > 0)

It's like sections of $context are not getting loaded....
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: shawnb61 on December 28, 2021, 12:58:34 PM
You would likely have to take those one by one...

shell_exec() is core php functionality.  Same input as above - if you don't have it, it has been disabled.  Either find a way to enable it, or, you can try what has been suggested elsewhere & disable hostname lookups.

create_function was removed in php 8 and is no longer used in SMF 2.0.19.  If you are seeing calls to create_function, you need to figure out which mod is doing that. 

I suspect that your other error messages are fallout from the two problems above.
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: shawnb61 on December 28, 2021, 01:57:03 PM
Note I logged #255 internally.  This should be rethunk, you shouldn't have to disable hostname lookups.
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: a10 on December 28, 2021, 02:58:07 PM
Ok thanks. Will let the case rest and stay with php 7.4 as long as available from host. By the time one may be forced towards php 8, I'll trust smf 2.1 to be ready & fully compatible. Then  re-evalaute any use of mods.

As for hosts lookups, used here as addon to reg questions, providing annoyances, blocking & redirects to some 'human bots' emanating from certain problematic countries.
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: spiros on January 02, 2022, 08:35:18 AM
So, does this mean this is a bug to be fixed in the future and that hostname lookups should normally be on and not giving shell_exec errors?
https://www.simplemachines.org/community/index.php?topic=577544.0
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: Sig on December 09, 2022, 09:54:39 AM
I know this is a dumb question but can somebody clarify how to disable host name lookup?
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: Steve on December 09, 2022, 09:57:11 AM
Admin -> Server Settings ... check the box that says 'Disable hostname lookups' and click save.
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: a10 on December 09, 2022, 02:54:41 PM
Benn running 2.0.19 with php 8.0 for a long time now. Moved up from 7.4 after hostname lookups were not needed (btw host has rightfully scrapped any option below 8.0). Zero errors & all runs perfect (while preparing for a 2.1.* upgrade, "soon").
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: gdavison on December 16, 2022, 04:55:32 AM
Quote from: a10 on December 09, 2022, 02:54:41 PMBenn running 2.0.19 with php 8.0 for a long time now. Moved up from 7.4 after hostname lookups were not needed (btw host has rightfully scrapped any option below 8.0). Zero errors & all runs perfect (while preparing for a 2.1.* upgrade, "soon").

Thanks for confirming this, my host will be dropping all versions of PHP < 8.0 at end of year .. so good to know 2.0.19 runs on 8.0 ... Have been testing 2.1 as well and will move to that soon
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: Steve on January 16, 2024, 08:46:50 AM
Quote from: gdavison on December 16, 2022, 04:55:32 AMHave been testing 2.1 as well and will move to that soon
This is your best course of action imo.

Keep in mind that all mods, including custom mods will be uninstalled and not all mods have been updated to work with 2.1.4 (although a large number of them have).

In addition most, if not all, your themes will not work either. There's a large selection of new themes as well.

The improvements in 2.1.4 far outweigh these issues.
Title: Re: 2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)
Post by: gdavison on March 27, 2024, 11:04:55 AM
Did the upgrade today .. went very well .. many thanks to all the devs / testers who laid all the foundations for a simple upgrade  :)