2.0.19 & PHP 8 (Call to undefined function shell_exec() errors)

Started by a10, December 28, 2021, 09:14:34 AM

Previous topic - Next topic

a10

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
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.


shawnb61

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.)
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Kindred

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....
Сл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."

shawnb61

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.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

shawnb61

Note I logged #255 internally.  This should be rethunk, you shouldn't have to disable hostname lookups.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

a10

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.
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

spiros

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

Sig

I know this is a dumb question but can somebody clarify how to disable host name lookup?

Steve

Admin -> Server Settings ... check the box that says 'Disable hostname lookups' and click save.
DO NOT pm me for support!

a10

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").
2.0.19, php 8.0.23, MariaDB 10.5.15. Mods: Contact Page, Like Posts, Responsive Curve, Search Focus Dropdown, Add Join Date to Post.

gdavison

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

Steve

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.
DO NOT pm me for support!

gdavison

Did the upgrade today .. went very well .. many thanks to all the devs / testers who laid all the foundations for a simple upgrade  :)

Advertisement: