News:

Wondering if this will always be free?  See why free is better.

Main Menu

SMF 2.0.17 to SMF 2.0.18 - Undefined index: sa

Started by willerby, February 08, 2021, 05:55:04 AM

Previous topic - Next topic

willerby

After upgrade with no errors I'm seeing lots of errors in the log as follows:


Guest
Type of error: Undefined
https://www.[forumURLremoved.com]/forum/index.php?type=rss;action=.xml
8: Undefined index: sa
File: /home/xxx/public_html/forum/Sources/News.php
Line: 68

Line 68 of News.php is as follows...
61:    // Show an xml file representing recent information or a profile.
62:    function ShowXmlFeed()
63:    {
64:    global $board, $board_info, $context, $scripturl, $txt, $modSettings, $user_info;
65:    global $query_this_board, $smcFunc, $forum_version, $cdata_override;
66:   
67:    // If it's not enabled, die.
68:    if (empty($modSettings['xmlnews_enable']) && ($_GET['sa'] !== 'profile' || $_GET['u'] !== $user_info['id']))
69:    obExit(false);

Many thanks for any help...
What type of washing machine is September?

An autumnatic. :)

willerby

Looks like this was a prior issue and not related to Upgrade. I hadd so many errors in my log as had upgraded to PHP 7.4, then when these all cleared with the latest PHP patch, it just left a load of the undefined index errors above which I assuemd were due to the patch. I took a look at News>Settings and RSS feeds as I recalled turning these off before Christmas, purely because noone uses them. Turns out someone was, hence all the errosr were coming from one account constantly trying to ping a News feed.
Having turned RSS feeds back on, no more errors
I don't understand all this but it may be useful to someone else.
What type of washing machine is September?

An autumnatic. :)

@rjen

I just switched the rss news feed off, just to find these errors in the log.
Does anyone know the fix for this error?

Undefined index: sa

SMF 2.0.18 and the exact same issue as described here

I do not want to reactivate the rss news feed.
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Aleksi "Lex" Kilpinen

Looking at that code, I'm thinking there might be a small bug in logic there...


if (empty($modSettings['xmlnews_enable']) && ($_GET['sa'] !== 'profile' || $_GET['u'] !== $user_info['id']))

So, if xmlnews_enable is empty AND sub action is anything else but profile then... But, what if subaction is empty? -> Undefined index.

I may be wrong. Someone correct me if I'm wrong.
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

@rjen

Yeah, it seems a bug in SMF itself.

I fixed it with this change just now..


// If it's not enabled, die.
if (empty($modSettings['xmlnews_enable']) && ((isset($_GET['sa']) !== 'profile') || $_GET['u'] !== $user_info['id']))
obExit(false);
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Sesquipedalian

#5
Quote from: @rjen on July 14, 2021, 05:54:47 AM
I fixed it with this change just now..

That logic has some problems. Try this instead:


// If it's not enabled, die.
if (empty($modSettings['xmlnews_enable']) && (empty($_GET['sa']) || empty($_GET['u']) || $_GET['sa'] !== 'profile' || $_GET['u'] !== $user_info['id']))
obExit(false);


Edit: The above code has be submitted for inclusion in 2.0.19 to fix to this bug permanently.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

@rjen

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Advertisement: