Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: Shades. on September 13, 2021, 02:57:35 AM

Title: 100 MessageIndex.template.php errors
Post by: Shades. on September 13, 2021, 02:57:35 AM
2.1RC4

Everytime I go to board=13 I get 100 of these and even on the child boards
QuoteError
Type of error
General
Error message
8: Trying to access array offset on value of type null
File
/home2/*****/public_html/*****/Themes/default/MessageIndex.template.php
Line
410
URL of page causing the error
https://********/index.php?board=13.0
Backtrace information
#0: smf_error_handler()
Called from /home2/*****/public_html/*****/Themes/default/MessageIndex.template.php on line 410
#1: template_bi_board_info()
Called from /home2/*****/public_html/*****/Themes/default/MessageIndex.template.php on line 43
#2: template_main()
Called from /home2/*****/public_html/*****/Sources/Load.php on line 2735
#3: loadSubTemplate()
Called from /home2/*****/public_html/*****/Sources/Subs.php on line 3540
#4: obExit()
Called from /home2/*****/public_html/*****/index.php on line 190
Title: Re: 100 MessageIndex.template.php errors
Post by: GL700Wing on September 13, 2021, 03:31:50 AM
Quote from: Shades. on September 13, 2021, 02:57:35 AM2.1RC4

Everytime I go to board=13 I get 100 of these and even on the child boards

Unlucky number maybe?   ;)
Title: Re: 100 MessageIndex.template.php errors
Post by: Arantor on September 13, 2021, 03:52:12 AM
So what's, say, line 400 through 420 of MessageIndex.template.php?
Title: Re: 100 MessageIndex.template.php errors
Post by: Shades. on September 13, 2021, 04:24:20 AM
Quote from: Arantor on September 13, 2021, 03:52:12 AMSo what's, say, line 400 through 420 of MessageIndex.template.php?

* Outputs the board info for a standard board or redirect.
 *
 * @param array $board Current board information.
 */
function template_bi_board_info($board)
{
global $context, $scripturl, $txt;

echo '
<a class="subject mobile_subject" href="', $board['href'], '" id="b', $board['id'], '">
', $board['name'], '&nbsp;<a href="' . $scripturl . '?action=.xml;board=' . $board['id'] . ';type=rss"><img src="' . $settings['images_url'] . '/rss.png" alt="rss" />
</a>';

// Has it outstanding posts for approval?
if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
echo '
<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link amt">!</a>';

echo '
<div class="board_description">', $board['description'], '</div>';
Title: Re: 100 MessageIndex.template.php errors
Post by: Antechinus on September 13, 2021, 04:31:40 AM
Why tf is that markup nesting an anchor inside another anchor?

See: https://html.spec.whatwg.org/#the-a-element

Specifically:
QuoteContent model:
    Transparent, but there must be no interactive content descendant, a element descendant, or descendant with the tabindex attribute specified.

ETA: Actually the anchor for .subject is unclosed, so that's another issue. The linked RSS icon should definitely not be inside a.subject though.
Title: Re: 100 MessageIndex.template.php errors
Post by: Arantor on September 13, 2021, 04:35:38 AM
Add $settings to the global line.

As for the nested links... 🤷‍♂️
Title: Re: 100 MessageIndex.template.php errors
Post by: Shades. on September 13, 2021, 04:43:10 AM
That did it thanks! :)

As for the nested link thats probably the rss feed mod I installed.  ???
Title: Re: 100 MessageIndex.template.php errors
Post by: Antechinus on September 13, 2021, 04:43:58 AM
Lolz. Sounds like a buggy mod.

ETA Just parsed the code for it here - https://custom.simplemachines.org/index.php?mod=376

Yup, it has a markup bug built in. Nice feature. :D
Title: Re: 100 MessageIndex.template.php errors
Post by: Antechinus on September 13, 2021, 04:48:54 AM
The finished markup should look like this.
<a class="subject mobile_subject" href="', $board['href'], '" id="b', $board['id'], '">
', $board['name'], '
</a>
&nbsp;
<a href="' . $scripturl . '?action=.xml;board=' . $board['id'] . ';type=rss">
<img src="' . $settings['images_url'] . '/rss.png" alt="rss" />
</a>';
Title: Re: 100 MessageIndex.template.php errors
Post by: Shades. on September 13, 2021, 04:49:33 AM
Quote from: Antechinus on September 13, 2021, 04:43:58 AMLolz. Sounds like a buggy mod.
I use it on another 2.1 site with the same mods and it works fine. This is on the one I'm trying to upgrade from 2.0.18 and nothing is going my way lol! I get one thing fixed and something else goes wrong, It's frustrating! >:(

But I'm getting it all worked out with the help of you fine folks! ;)  8)
Title: Re: 100 MessageIndex.template.php errors
Post by: Shades. on September 13, 2021, 04:51:44 AM
Quote from: Antechinus on September 13, 2021, 04:48:54 AMThe finished markup should look like this.
<a class="subject mobile_subject" href="', $board['href'], '" id="b', $board['id'], '">
', $board['name'], '
</a>
&nbsp;
<a href="' . $scripturl . '?action=.xml;board=' . $board['id'] . ';type=rss">
<img src="' . $settings['images_url'] . '/rss.png" alt="rss" />
</a>';
Do I still need to add $settings to the global line?
Title: Re: 100 MessageIndex.template.php errors
Post by: Antechinus on September 13, 2021, 04:55:09 AM
Yes, you do need $settings in the globals for that function.
Title: Re: 100 MessageIndex.template.php errors
Post by: Arantor on September 13, 2021, 05:19:33 AM
Yup, because it calls $settings for the path to images like the RSS icon.
Title: Re: 100 MessageIndex.template.php errors
Post by: Shades. on September 13, 2021, 05:36:26 AM
Oh ok thanks! Much appreciated! ;)