Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: shadav on September 12, 2019, 10:35:56 PM

Title: what causes 8: Undefined index:
Post by: shadav on September 12, 2019, 10:35:56 PM
I have a ton of these errors in my log, I keep clearing my cache, and then clearing the logs but still they pop right back up

from what I gather, it's nothing really important.... but it's annoying
and most seem to say that it's language files, i've tried to compare and make sure that the language strings are there but still tons of 8: Undefined index: bla bla bla

am I missing something? Should I just not be worried with it? They build up fairly quickly.....
Title: Re: what causes 8: Undefined index:
Post by: Kindred on September 12, 2019, 11:19:12 PM
Please list the EXACT error message(s)
Title: Re: what causes 8: Undefined index:
Post by: SpacePhoenix on September 13, 2019, 02:11:29 AM
What version of SMF?

What version of PHP is the server using?

What mods does SMF have installed?
Title: Re: what causes 8: Undefined index:
Post by: shadav on September 13, 2019, 04:38:30 AM
Quote from: SpacePhoenix on September 13, 2019, 02:11:29 AM
What version of SMF?

What version of PHP is the server using?

What mods does SMF have installed?

2.0.15, php 7.1....too many mods....

Quote from: Kindred on September 12, 2019, 11:19:12 PM
Please list the EXACT error message(s)

8: Undefined index: board_stats_limit
/Themes/default/languages/BoardStats.english.php (eval?)
Line: 13

8: Undefined index: board_stats_limit
/Themes/default/languages/PMAttachments.english-utf8.php (eval?)
Line: 13

8: Undefined index: description
/Themes/default/languages/AlternativeMenu.english.php (generic_menu_dropdown_above sub template - eval?)
Line: 303

8: Undefined index: title
/Themes/default/languages/AlternativeMenu.english.php (generic_menu_dropdown_above sub template - eval?)
Line: 291

8: Undefined index: BuyMeIcon
/Sources/Load.php
Line: 1286

8: Undefined index: additional_groups
/Sources/Load.php
Line: 1088

8: Undefined index: allow_hof
/Sources/Subs.php
Line: 4455

8: Undefined index: allow_view_blogs
/Sources/Subs.php
Line: 4387

8: Undefined index: allow_view_kb
/Sources/Subs.php
Line: 4373

8: Undefined index: blogs
/Sources/Subs.php
Line: 4385

8: Undefined index: kb
/Sources/Subs.php
Line: 4371

to name a few
Title: Re: what causes 8: Undefined index:
Post by: Arantor on September 13, 2019, 04:42:58 AM
Better question, what language packs do you have installed?
Title: Re: what causes 8: Undefined index:
Post by: shadav on September 13, 2019, 11:33:09 AM
Quote from: Arantor on September 13, 2019, 04:42:58 AM
Better question, what language packs do you have installed?

english and utf 8 english
Title: Re: what causes 8: Undefined index:
Post by: Kindred on September 13, 2019, 11:42:41 AM
well, most of those appear to be mod related.... which, as Arantor suggests, indicates that the mod may not have been installed in all languages.

Make sure all strings exist in both modifications.english.php and modifications.english-utf8.php
Title: Re: what causes 8: Undefined index:
Post by: shadav on September 22, 2019, 11:42:22 AM
Quote from: Kindred on September 13, 2019, 11:42:41 AM
well, most of those appear to be mod related.... which, as Arantor suggests, indicates that the mod may not have been installed in all languages.

Make sure all strings exist in both modifications.english.php and modifications.english-utf8.php

so even if they have their own language file, i should still add them to the modifications.english.php and utf8 files?
Title: Re: what causes 8: Undefined index:
Post by: Antechinus on September 22, 2019, 08:23:42 PM
If they're creating undefined index errors, that means somehow the strings (assuming they exist somewhere) aren't being read by SMF. So adding them to a default languages file should fix that.

The other possibility is that that have been shunted into a function which doesn't declare $txt as a global. That may be worth checking too. Shouldn't apply to most cases, but is a possibility. If that's the problem just add $txt to the globals at the start of the function and it should be good to go.

ETA: While I think of it, might be a good idea to check for missing globals in general. For example if $modSettings is required and ain't there, that might also bork the language strings for the relevant mod.
Title: Re: what causes 8: Undefined index:
Post by: shadav on July 06, 2020, 09:24:23 PM
and i'm back to this issue  :P

keep getting a recurring one
Undefined index: page_title_html_safe

I have added to both the modifications.english.php and the utf-8

$txt['page_title_html_safe'] = 'Page Title';

but still this error keeps showing up in my logs....
Title: Re: what causes 8: Undefined index:
Post by: Sir Osis of Liver on July 06, 2020, 09:35:43 PM
Post the complete error.
Title: Re: what causes 8: Undefined index:
Post by: shadav on July 06, 2020, 10:03:26 PM
8: Undefined index: page_title_html_safe
File: /Sources/Subs.php
Line: 1339

line 1339
'content' => '<img src="$1" alt="' . $context['page_title_html_safe'] . '" class="bbc_img" />',
Title: Re: what causes 8: Undefined index:
Post by: Sir Osis of Liver on July 06, 2020, 10:48:33 PM
Not core code, must be from a mod.  Something's calling the index before it's defined.  If nothing's broken, you can fudge the error by defining the variable, you just have to do it in the right place (somewhere before line 1339).



if(!isset($context['page_title_html_safe']))
       $context['page_title_html_safe'] = null;



If you get it right, should eliminate the error.
Title: Re: what causes 8: Undefined index:
Post by: shadav on July 06, 2020, 11:12:01 PM
thank you...that seems to have cleared out all the log errors  :D