Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Ninja ZX-10RR on September 16, 2014, 12:32:57 PM

Title: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 12:32:57 PM
Hi all, like the title suggests I have been getting random Undefined indexes from my Load.php at totally random actions, it didn't "start" after installing something or at a definite moment... It started to happen just randomly and with totally random actions (once it was removing an uninstalled package from mods list and this time was accessing mods settings, but it happened with more things). Here you go the error is this one:

Quote8: Undefined index: actual_theme_dir
/Sources/Load.php
Line: 2341
The file is attached of course :)

The mods list is pretty long but I don't think it is the cause of the problem taking a look at this it seems to be an old problem never really solved. Tried to repeat the string already and it gets only worse since it throws an error all the time I do anything that way... --> http://www.simplemachines.org/community/index.php?topic=427245.0
Anyway... Mods list follows.

1. Browser Language Detection and Loading 0.1.0 N/A [ Install Mod ] [ List Files ] [ Delete ]
2. detectBrowser Update 1.0.1 N/A [ Install Mod ] [ List Files ] [ Delete ]
3. EmailValidator 1.0 N/A [ Install Mod ] [ List Files ] [ Delete ]
4. Enhanced PM System 1.4 N/A [ Install Mod ] [ List Files ] [ Delete ]
5. Forum Firewall 2.0.0 N/A [ Install Mod ] [ List Files ] [ Delete ]
6. jQLightbox 0.6 N/A [ Install Mod ] [ List Files ] [ Delete ]
7. MCLegendII RC3 3.0 N/A [ Install Mod ] [ List Files ] [ Delete ]
8. nneonneo's AJAX ShoutBox 1.22 N/A [ Install Mod ] [ List Files ] [ Delete ]
9. Reason For Editing Mod 2.3.2 N/A [ Install Mod ] [ List Files ] [ Delete ]
10. ResizeImagesToFitScreen 0.1.6 N/A [ Install Mod ] [ List Files ] [ Delete ]
11. Slash through Banned Usernames 2.0 N/A [ Install Mod ] [ List Files ] [ Delete ]
12. SMF Likes Plus 1.5 N/A [ Install Mod ] [ List Files ] [ Delete ]
13. User Agreement Update 1.0.3 N/A [ Install Mod ] [ List Files ] [ Delete ]
14. Allocate More RAM mod 1.0  April 19, 2014, 06:23:02 PM [ Uninstall ] [ List Files ] [ Delete ]
15. Delete Spam Posts 1.6  April 21, 2014, 06:33:04 PM [ Uninstall ] [ List Files ] [ Delete ]
16. ShowBannedMessage 1.3  April 21, 2014, 06:35:20 PM [ Uninstall ] [ List Files ] [ Delete ]
17. Move Topic Notification 1.2  April 21, 2014, 06:36:28 PM [ Uninstall ] [ List Files ] [ Delete ]
18. open mod reports 1.0  April 21, 2014, 06:43:56 PM [ Uninstall ] [ List Files ] [ Delete ]
19. Admin Notes 2.0  April 21, 2014, 06:45:28 PM [ Uninstall ] [ List Files ] [ Delete ]
20. Karma/Rep Limit 1.0.1  April 21, 2014, 06:48:26 PM [ Uninstall ] [ List Files ] [ Delete ]
21. Anti Bot: Are You Human/Bot? 3.0  April 21, 2014, 06:49:20 PM [ Uninstall ] [ List Files ] [ Delete ]
22. Quick Ban on Account Delete 1.0.1  April 22, 2014, 02:07:56 AM [ Uninstall ] [ List Files ] [ Delete ]
23. SMFPacks Shoutbox 1.0.5  April 22, 2014, 02:08:43 AM [ Uninstall ] [ List Files ] [ Delete ]
24. Order Custom Profile Fields 1.1.1  April 22, 2014, 02:26:56 AM [ Uninstall ] [ List Files ] [ Delete ]
25. Disable to send EMail with Forum-System for Users lower than Admin 1.0  April 22, 2014, 02:59:53 AM [ Uninstall ] [ List Files ] [ Delete ]
26. TalkBox3 2.0  April 22, 2014, 06:11:20 AM [ Uninstall ] [ List Files ] [ Delete ]
27. last login 2.9  April 23, 2014, 04:44:41 AM [ Uninstall ] [ List Files ] [ Delete ]
28. Next Post Level 1.3.3  April 24, 2014, 11:27:35 PM [ Uninstall ] [ List Files ] [ Delete ]
29. Post History 1.03  April 25, 2014, 02:31:33 AM [ Uninstall ] [ List Files ] [ Delete ]
30. Topic Solved 1.1.1  April 26, 2014, 06:35:12 AM [ Uninstall ] [ List Files ] [ Delete ]
31. Bad Behavior mod 1.5.18  April 26, 2014, 04:05:42 PM [ Uninstall ] [ List Files ] [ Delete ]
32. CloudFlare 1.1  April 26, 2014, 04:58:14 PM [ Uninstall ] [ List Files ] [ Delete ]
33. Users Online Today 2.1  April 26, 2014, 09:11:12 PM [ Uninstall ] [ List Files ] [ Delete ]
34. Increase Number of Visitors (cheat) 1.0  April 26, 2014, 11:15:20 PM [ Uninstall ] [ List Files ] [ Delete ]
35. Ban List 2.0  April 27, 2014, 01:48:40 AM [ Uninstall ] [ List Files ] [ Delete ]
36. 'Read the Rules' Link Above Post Button 2.0  April 27, 2014, 02:28:50 AM [ Uninstall ] [ List Files ] [ Delete ]
37. Enhanced PM Popup 1.0.1  April 27, 2014, 02:54:16 AM [ Uninstall ] [ List Files ] [ Delete ]
38. Advanced Signature 0.3.0 beta 1  April 29, 2014, 04:21:19 AM [ Uninstall ] [ List Files ] [ Delete ]
39. Sortable Packages (and Installed Time) 1.3.5  April 30, 2014, 01:45:39 AM [ Uninstall ] [ List Files ] [ Delete ]
40. Anti-Spam Links 1.0.1  April 30, 2014, 02:36:24 PM [ Uninstall ] [ List Files ] [ Delete ]
41. Add Facebook Like to Posts 1.1  May 01, 2014, 12:40:38 AM [ Uninstall ] [ List Files ] [ Delete ]
42. PM to New Members 1.2  May 02, 2014, 06:25:55 PM [ Uninstall ] [ List Files ] [ Delete ]
43. Allow Access while in Maintenance Mode 1.2  May 03, 2014, 09:19:17 PM [ Uninstall ] [ List Files ] [ Delete ]
44. Activity in Profile 1.1  May 03, 2014, 09:27:56 PM [ Uninstall ] [ List Files ] [ Delete ]
45. Ad Managment 3.2  May 03, 2014, 09:54:28 PM [ Uninstall ] [ List Files ] [ Delete ]
46. Custom Copyright 1.0.4  May 04, 2014, 02:57:46 AM [ Uninstall ] [ List Files ] [ Delete ]
47. Fake Topic Views 0.1  May 06, 2014, 12:01:47 AM [ Uninstall ] [ List Files ] [ Delete ]
48. Ban Filter 1.0  May 06, 2014, 12:05:46 AM [ Uninstall ] [ List Files ] [ Delete ]
49. Ohara YouTube Embed 1.2  May 09, 2014, 09:12:30 AM [ Uninstall ] [ List Files ] [ Delete ]
50. Bookmarks 2.5  May 17, 2014, 12:36:49 AM [ Uninstall ] [ List Files ] [ Delete ]
51. Global Topics 2.2  May 20, 2014, 12:30:45 AM [ Uninstall ] [ List Files ] [ Delete ]
52. Register Redirect 1.0  May 28, 2014, 10:20:43 AM [ Uninstall ] [ List Files ] [ Delete ]
53. Install & Uninstall Mods Quickly 1.4  May 31, 2014, 09:49:56 PM [ Uninstall ] [ List Files ] [ Delete ]
54. Tinypic Plugin 1.0.0  May 31, 2014, 09:51:08 PM [ Uninstall ] [ List Files ] [ Delete ]
55. SimpleDesk - Integrated Helpdesk for Simple Machines Forum 2.0  May 31, 2014, 10:37:17 PM [ Uninstall ] [ List Files ] [ Delete ]
56. To Buddies 1.01  June 01, 2014, 11:06:29 PM [ Uninstall ] [ List Files ] [ Delete ]
57. Time Online on Memberlist 1.00  June 04, 2014, 06:30:40 AM [ Uninstall ] [ List Files ] [ Delete ]
58. Profile Song Player 1.0 Beta  June 06, 2014, 05:42:26 PM [ Uninstall ] [ List Files ] [ Delete ]
59. Permissions Info 1.6  June 06, 2014, 05:48:00 PM [ Uninstall ] [ List Files ] [ Delete ]
60. Ignore Topics 2.3  June 14, 2014, 12:33:12 AM [ Uninstall ] [ List Files ] [ Delete ]
61. SMF 2.0.8 Update 1.0  June 19, 2014, 01:56:09 AM [ Uninstall ] [ List Files ] [ Delete ]
62. Caps_Lock_Detection_on_Login 1.1.0.2  June 21, 2014, 09:45:33 AM [ Uninstall ] [ List Files ] [ Delete ]
63. SimpleColorizer 1.1  June 23, 2014, 08:46:32 PM [ Uninstall ] [ List Files ] [ Delete ]
64. Board Index Unread Icon Fix 1.0  June 27, 2014, 02:28:34 PM [ Uninstall ] [ List Files ] [ Delete ]
65. Country Flags 2.1  June 28, 2014, 05:27:51 PM [ Uninstall ] [ List Files ] [ Delete ]
66. PM Settings 1.0.1  June 29, 2014, 09:13:36 PM [ Uninstall ] [ List Files ] [ Delete ]
67. Undeletables topics PMs and users 0.1.5  June 30, 2014, 05:09:57 AM [ Uninstall ] [ List Files ] [ Delete ]
68. Working top level links for drop menus 1.0  July 04, 2014, 04:21:40 AM [ Uninstall ] [ List Files ] [ Delete ]
69. Email Inactive Users 1.1  July 15, 2014, 02:10:39 PM [ Uninstall ] [ List Files ] [ Delete ]
70. Similar Topics 0.6  July 15, 2014, 03:08:26 PM [ Uninstall ] [ List Files ] [ Delete ]
71. Custom Pages and Tabs (2) SMF 2 - RC3 1.1  July 15, 2014, 06:06:40 PM [ Uninstall ] [ List Files ] [ Delete ]
72. Add [li] Button 1.0  July 24, 2014, 05:49:39 PM [ Uninstall ] [ List Files ] [ Delete ]
73. Multiple QA support 1.0.1  July 24, 2014, 05:53:51 PM [ Uninstall ] [ List Files ] [ Delete ]
74. Add Honey Pot to Track IP 1.1  August 04, 2014, 03:56:46 PM [ Uninstall ] [ List Files ] [ Delete ]
75. Misc Anti Spam 1.0  August 04, 2014, 04:00:43 PM [ Uninstall ] [ List Files ] [ Delete ]
76. Stop Forum Spam 1.0  August 04, 2014, 04:06:56 PM [ Uninstall ] [ List Files ] [ Delete ]
77. Word Censor List 1.1  August 04, 2014, 06:29:11 PM [ Uninstall ] [ List Files ] [ Delete ]
78. Better Profile Menu 1.2  August 06, 2014, 06:29:50 AM [ Uninstall ] [ List Files ] [ Delete ]
79. Personalized BBC 1.5  August 06, 2014, 06:46:24 AM [ Uninstall ] [ List Files ] [ Delete ]
80. Prevent Topic View Increase by Author 1.0  August 06, 2014, 06:51:58 AM [ Uninstall ] [ List Files ] [ Delete ]
81. Confirmation message to Mark as Read 1.00  August 06, 2014, 06:53:27 AM [ Uninstall ] [ List Files ] [ Delete ]
82. Add [nobbc] button 1.1  August 06, 2014, 06:58:31 AM [ Uninstall ] [ List Files ] [ Delete ]
83. Admin Ban Button in Post 3.0  August 06, 2014, 07:38:48 AM [ Uninstall ] [ List Files ] [ Delete ]
84. Change All Subjects 1.3  August 06, 2014, 07:46:52 AM [ Uninstall ] [ List Files ] [ Delete ]
85. Drafts 2.0.5  August 06, 2014, 08:23:17 PM [ Uninstall ] [ List Files ] [ Delete ]
86. Minimum Characters for Search 1.2.1  August 06, 2014, 08:43:28 PM [ Uninstall ] [ List Files ] [ Delete ]
87. Order Stickied Topics 1.01  August 06, 2014, 09:38:34 PM [ Uninstall ] [ List Files ] [ Delete ]
88. Referrals System 3.1  August 06, 2014, 09:45:02 PM [ Uninstall ] [ List Files ] [ Delete ]
89. Annoy User 1.2.4  August 06, 2014, 11:24:46 PM [ Uninstall ] [ List Files ] [ Delete ]
90. Restrict Email Providers on Registration 1.2  August 06, 2014, 11:40:08 PM [ Uninstall ] [ List Files ] [ Delete ]
91. Groups See Hidden Users 1.0  August 06, 2014, 11:51:30 PM [ Uninstall ] [ List Files ] [ Delete ]
92. BBC In Custom Title 2.0r2 - SMF 2.0.x  August 07, 2014, 12:08:24 AM [ Uninstall ] [ List Files ] [ Delete ]
93. Integration Hooks Report 1.5.3  August 07, 2014, 10:03:01 PM [ Uninstall ] [ List Files ] [ Delete ]
94. Lazy Admin Menu 1.6  August 22, 2014, 12:11:19 AM [ Uninstall ] [ List Files ] [ Delete ]
95. Member Color Link 3.1  August 22, 2014, 05:45:11 PM [ Uninstall ] [ List Files ] [ Delete ]
96. Invitation Message In Your Face (IMIYF) 0.3.2  August 22, 2014, 05:47:50 PM [ Uninstall ] [ List Files ] [ Delete ]
97. Google Wallet Subscriptions 1.0.3.2  August 27, 2014, 02:18:14 AM [ Uninstall ] [ List Files ] [ Delete ]
98. Additional Topic Authors 0.1.1  August 28, 2014, 05:28:21 PM [ Uninstall ] [ List Files ] [ Delete ]
99. Rank Image Drop Down 1.0  August 29, 2014, 04:56:55 PM [ Uninstall ] [ List Files ] [ Delete ]
100. Buddies List 1.0.1  August 29, 2014, 06:05:11 PM [ Uninstall ] [ List Files ] [ Delete ]
101. Enhancements to reattribute posts 1.5.6  August 30, 2014, 08:26:35 PM [ Uninstall ] [ List Files ] [ Delete ]
102. Moderator and Administrator Comment Tags 1.8.1  September 03, 2014, 05:11:24 PM [ Uninstall ] [ List Files ] [ Delete ]
103. SA Chat 0.1.4 Rev105  September 03, 2014, 08:45:49 PM [ Uninstall ] [ List Files ] [ Delete ]
104. Sisyphus 1.0  September 04, 2014, 07:55:40 AM [ Uninstall ] [ List Files ] [ Delete ]
105. Login Detector 1.0  September 05, 2014, 06:06:20 AM [ Uninstall ] [ List Files ] [ Delete ]
106. LUP: Logout Under Profile 1.0.0  September 05, 2014, 06:22:32 PM [ Uninstall ] [ List Files ] [ Delete ]
107. Spoiler BBCode 1.1.3  September 11, 2014, 08:21:22 PM [ Uninstall ] [ List Files ] [ Delete ]
108. Hide PM Text in Email Notifications 1.0  September 13, 2014, 06:03:20 PM [ Uninstall ] [ List Files ] [ Delete ]
109. Users mass actions 0.1.1  Today at 12:17:50 AM [ Uninstall ] [ List Files ] [ Delete ]
110. Yellow: Highlight Package On Hover 1.1.0  Today at 03:09:55 AM [ Uninstall ] [ List Files ] [ Delete ]
111. Group Key Order and Style 1.1  Today at 06:14:02 PM [ Uninstall ] [ List Files ] [ Delete ]


Thanks for any help you can provide and sorry if we will discover that is not being a bug, even if IMHO it is... Ah yeah, almost forgot, using the default theme and utf-8 language. :)
Title: Re: Undefined index in load.php randomly
Post by: Kindred on September 16, 2014, 01:04:25 PM
Well, since it does not happen on every forum... And definitely does not happen on a unmodified 2.0.8 installation, it is not actually an smf bug and is most definitely related to one or more of your mods or themes...

As such, moving to support rather then bug reports.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 01:13:42 PM
Quote from: ♦ Ninja ZX-10RR ♦ on September 16, 2014, 12:32:57 PM
using the default theme
Definitely not theme though.
Like I said there was not a real day when it started to happen and also it happens in actions that are not affected by any mods (such as removing a package from the package manager...No mods affected that function) so I am not entirely sure about that. But anyway, I'm waiting for some good soul to have a look since looking at older topics I couldn't find a real solution in any of them...
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 16, 2014, 01:26:03 PM
I was thinking that it could be coming from some other files and not from Load.php since only a few make direct modifications to it. Again, this is just a guess and I may be wrong. Anyway, just to confirm, is your template evaluation disabled? If I remember correctly, error can sometimes points to wrong file if it is enabled.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 02:12:41 PM
I think it didn't make a difference because I was keeping it disabled since it wasn't making a difference... At the time of the report it was enabled but at the time of the other errors it used to be disabled, I am 99% sure of it.
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 16, 2014, 03:18:14 PM
Downloaded the Load.php and find that the said line 2341 is the same as default in line 2046. Try to shortlist mods that use or change actual theme directory.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 03:51:21 PM
None of them since I use default theme...
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 16, 2014, 03:58:42 PM
Default theme can be one of the "actual theme" in use IMO.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 04:21:23 PM
Well it's the ONLY one available since users are not allowed to switch between themes...
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 16, 2014, 05:06:30 PM
Quote from: ahrasis on September 16, 2014, 01:26:03 PM
Again, this is just a guess and I may be wrong.

I am with Kindred and I definitely don't think it is coming from SMF software. The only possibilities left is your mods but you have to narrow it down yourself. I won't go deep for that as I was only trying to help you nail it down based on your given facts. We may also have some sort of language barrier here and as such, I couldn't make it clearer for you. So, may be you can just wait for others to help you with this. Good luck in solving the issues. I'll only be watching from now on. ;)
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 05:25:39 PM
:'( I am clueless on this, that's why I posted... Thanks for the help anyway, still unsolved, waiting for more people to join the discussion :(
Title: Re: Undefined index in load.php randomly
Post by: Night09 on September 16, 2014, 07:36:22 PM
Try adding the following to index.english.php in the languages folder

$txt['actual_theme_dir'] = 'Actual theme Directory';

Text may be wrong as I dont know what it relates too but it appears its looking for something not there so worth a try.
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 16, 2014, 07:39:46 PM
It's not related to a txt string. It's looking for a $settings entry.

I've seen this before, usually on themes that aren't set up properly internally but I've never been able to definitely nail it down before.

Easy fix:
Code (find) Select
$language_directories = array(
$settings['default_theme_dir'] . '/languages',
$settings['actual_theme_dir'] . '/languages',
);


Code (replace) Select
$language_directories = array(
$settings['default_theme_dir'] . '/languages',
);
if (!empty($settings['actual_theme_dir']))
$language_directories[] = $settings['actual_theme_dir'] . '/languages';


Could even roll that into the base distribution to prevent this being an issue in future. (This has been done already in 2.1, and I know this because I did it albeit slightly differently there. This commit (https://github.com/SimpleMachines/SMF2.1/commit/a80c197d8f0e75611f88831dde58c84f21afdcd3) for the curious.)
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 16, 2014, 09:07:05 PM
Of course comes Arantor and fixes it in a minute... Thanks once again :D marking it as solved for now. I will unmark and post again if that happens again but I don't think so..
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 17, 2014, 12:09:55 AM
$txt['actual_theme_dir'] is actually used and defined in Theme template and language. But that is not the case anyway.

My understanding - Default theme is always there as a backup if you use other theme as actual theme. Default theme therefore is the actual theme when there is no others.

By the given code, it is suggested that only when your actual theme directory is not empty then the actual theme directory will be used. Meaning, if you are using default, it is suggested that sometimes your default theme is not considered as actual theme where as IMO it should be.

A deeper look is needed to your mod(s) and Load.php file. For instance, your Load.php is actually missing some code most probably due to mod(s). Here is one of them:

// Write the file.
if (function_exists('file_put_contents'))
{
$cache_bytes = @file_put_contents($cachedir . '/data_' . $key . '.php', $cache_data, LOCK_EX);
if ($cache_bytes != strlen($cache_data))
@unlink($cachedir . '/data_' . $key . '.php');
}
else
{

The original code for this part is:

// Otherwise custom cache?
else
{
if ($value === null)
@unlink($cachedir . '/data_' . $key . '.php');
else
{
$cache_data = '<' . '?' . 'php if (!defined(\'SMF\')) die; if (' . (time() + $ttl) . ' < time()) $expired = true; else{$expired = false; $value = \'' . addcslashes($value, '\\\'') . '\';}' . '?' . '>';
// Write the file.
if (function_exists('file_put_contents'))
{
$cache_bytes = @file_put_contents($cachedir . '/data_' . $key . '.php', $cache_data, LOCK_EX);
if ($cache_bytes != strlen($cache_data))
@unlink($cachedir . '/data_' . $key . '.php');
}
else
{
// Write the file.
if (function_exists('file_put_contents'))
{
$cache_bytes = @file_put_contents($cachedir . '/data_' . $key . '.php', $cache_data, LOCK_EX);
if ($cache_bytes != strlen($cache_data))
@unlink($cachedir . '/data_' . $key . '.php');
}
else
{
$fh = @fopen($cachedir . '/data_' . $key . '.php', 'w');
if ($fh)
{
// Write the file.
set_file_buffer($fh, 0);
flock($fh, LOCK_EX);
$cache_bytes = fwrite($fh, $cache_data);
flock($fh, LOCK_UN);
fclose($fh);

// Check that the cache write was successful; all the data should be written
// If it fails due to low diskspace, remove the cache file
if ($cache_bytes != strlen($cache_data))
@unlink($cachedir . '/data_' . $key . '.php');
}
}
}
}
}


Your code for this part is:
// Otherwise custom cache?
else
{
if ($value === null)
@unlink($cachedir . '/data_' . $key . '.php');
else
{
$cache_data = '<' . '?' . 'php if (!defined(\'SMF\')) die; if (' . (time() + $ttl) . ' < time()) $expired = true; else{$expired = false; $value = \'' . addcslashes($value, '\\\'') . '\';}' . '?' . '>';
// Write the file.
if (function_exists('file_put_contents'))
{
$cache_bytes = @file_put_contents($cachedir . '/data_' . $key . '.php', $cache_data, LOCK_EX);
if ($cache_bytes != strlen($cache_data))
@unlink($cachedir . '/data_' . $key . '.php');
}
else
{
$fh = @fopen($cachedir . '/data_' . $key . '.php', 'w');
if ($fh)
{
// Write the file.
set_file_buffer($fh, 0);
flock($fh, LOCK_EX);
$cache_bytes = fwrite($fh, $cache_data);
flock($fh, LOCK_UN);
fclose($fh);

// Check that the cache write was successful; all the data should be written
// If it fails due to low diskspace, remove the cache file
if ($cache_bytes != strlen($cache_data))
@unlink($cachedir . '/data_' . $key . '.php');
}
}
}
}


I do not know whether it is related or not. But replacing your undefined_index_error Load.php where some code are missing with the code from default may help in narrowing down IMO. Again, I could be wrong but if you can, compare your Load.php with default and fill in the missing code.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 17, 2014, 01:02:09 AM
No way! That file has been edited if I just "fill it" it will break a lot of things, and that is not a guess, it's for sure. It has been edited by all of those mods and I am happy as it is now, looking at Arantor's fix (despite my limited knowledge of .php) it should work to avoid that error being shown in the error log. As regards the reason of it I have no clues as stated many times before, also it is not affecting any function so just not showing the error is fine since it doesn't affect anything :)
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 17, 2014, 01:31:25 AM
You stated that it starts by "removing an uninstalled package from mods list and this time was accessing mods settings, but it happened with more things", so IMO something that was changed definitely is causing this error. Since you firstly posted this as a bug, I am more interested in finding the real cause of the problem.

But I guess that it is not urgent nor important to you anymore. Sorry, if I did bother you with suggestions to find its real cause and proper solution as I was thinking you were interested in it. Anyway, so long that permanently fixed what is broken and you are happy with it, I guess it should be fine.

Again, I could be wrong. ;)
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 17, 2014, 01:40:07 AM
You are only wrong when you say that I am not interested into it ;) I do am interested into it but if a solution has been found I take it as solved :) I am still wondering why it happened though, it happened with total random actions (including seeing the logs and logging out once) that it made me think more about a bug rather than a problem with a mod since a mod could affect an action or a few actions, not such a wide range of actions... But since there was not a "start" for this bug nor an action that took place before it started and that it happened *that* randomly I can't help it much better than this anyway :/
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 17, 2014, 06:35:10 AM
QuoteMy understanding - Default theme is always there as a backup if you use other theme as actual theme. Default theme therefore is the actual theme when there is no others.

Yes, but actual_theme_dir is also sometimes used. It's also sometimes not. To the point where it can manifest undefined.

Technically, default theme should be the very very last line of defence for this stuff, and actual_theme_dir should be applicable if you have a theme based on another theme (in theory, it's complicated) so the idea is that you check that second and load the language file from it so the default theme doesn't override it. It is more likely an SMF bug than anything else. SMF does in fact have bugs occasionally.

Regarding the cache code, there is no problem with this and it is not mod related but a human error discrepancy between 2.0.7/8 patching and 2.0.7/8 full install. It is of no concern.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 17, 2014, 07:36:44 AM
Well I am glad that you call it a bug because I couldn't describe it in any other words.. I don't know if Kindred wants to put it back in bugs since from what we could see it is a bug (unfortunately) :/
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 17, 2014, 10:43:59 PM
Quote from: ♦ Ninja ZX-10RR ♦ on September 17, 2014, 01:40:07 AM
You are only wrong when you say that I am not interested into it

Unless it is clearly stated in my posts, I denied claiming as such. :P

By the way, if it is a bug, I guess Arantor as SMF Friends can re-suggest it to the Team. They'll take his words. ;)
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 17, 2014, 10:44:40 PM
Did we skip the part where 2.1 already includes me having already fixed this bug?
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 17, 2014, 11:22:22 PM
You didn't say it is a bug in SMF 2.0. You said you cannot nail it down i.e. you do not the cause. You did suggest this to be put in the distribution base though and you did mention this already ends up in 2.1 as per your commit. May be I just read your posts literally and not laterally and that's why I was trying to look for the cause. I like it when I am doing that because that way, I'll learn more. No offence at all.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 17, 2014, 11:29:43 PM
Quote from: ahrasis on September 17, 2014, 10:43:59 PM
Quote from: ♦ Ninja ZX-10RR ♦ on September 17, 2014, 01:40:07 AM
You are only wrong when you say that I am not interested into it
Unless it is clearly stated in my posts, I denied claiming as such. :P
Quote from: ahrasis on September 17, 2014, 01:31:25 AM
You stated that it starts by "removing an uninstalled package from mods list and this time was accessing mods settings, but it happened with more things", so IMO something that was changed definitely is causing this error. Since you firstly posted this as a bug, I am more interested in finding the real cause of the problem.

But I guess that it is not urgent nor important to you anymore. Sorry, if I did bother you with suggestions to find its real cause and proper solution as I was thinking you were interested in it. Anyway, so long that permanently fixed what is broken and you are happy with it, I guess it should be fine.

Again, I could be wrong. ;)
...You did say that.
And you did miss also this
Quote from: Arantor on September 17, 2014, 06:35:10 AM
It is more likely an SMF bug than anything else.

I think we can consider this as solved and hopefully by 2.10 having a patch for it? I am not experiencing the issue anymore so I think that Arantor fixed it :)
Title: Re: Undefined index in load.php randomly
Post by: Kindred on September 17, 2014, 11:32:45 PM
Meh... Probably not going. To be fixed in 2.0.x, given the release of 2.0.9 and the soon to be beta of 2.1
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 17, 2014, 11:37:24 PM
Wait. Will the development for 2.0.x stop after the release of 2.1? It sounded like that :/
Title: Re: Undefined index in load.php randomly
Post by: Kindred on September 17, 2014, 11:41:32 PM
With the exception of security releases, yes.   The same way development on 1.1.x stopped when 2.0 was released
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 17, 2014, 11:43:13 PM
That's not good news to me but thank you for telling me that, I couldn't have known it since I wasn't here when 1.1.x stopped ;) well then I will just keep the hotfix from Arantor and thank everybody as always :D
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 17, 2014, 11:45:51 PM
That concludes it.

By the way, Ninja, just for the sake of "chatting" with you, please read the whole sentence. You are not interested in it "anymore" is what I clearly mean. And I already noted that Arantor said "it is more likely".

I personally reckon the whole code that relates to it are to be examined not just the particular line in Load.php, as for me, they are related to each other. But I shouldn't be saying that as I know nothing about coding SMF anyway. Well, anyway, the rule says, don't fix it until it is broken. :P

Cheers!
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 18, 2014, 07:58:10 AM
To be explained... the codebase of SMF is sufficiently complicated it is not always possible to pin down an actual cause to a bug.

We're talking about a bug that manifests itself very sporadically, without any ability to consistently reproduce. In a code base where parts of it have NPath complexities in the obscene proportions: 'good style' guides recommend you keep method NPath complexity under 200; I've been known to have routines into the billions, SMF has routines whose complexity is a 40+ digit number, it's simply impossible to be able to handle every possible permutation of operations of the base software.

If anyone could do that, it would probably be me, and I can't. All I can do is observe a fault condition and apply a preventative measure to prevent it from being an actual problem. I have not been able to reliably identify the situation which causes it. Doesn't mean it can't be done, nor necessarily does it mean it's worth my time to do, because in all honesty it isn't.
Title: Re: Undefined index in load.php randomly
Post by: Ninja ZX-10RR on September 18, 2014, 08:12:36 AM
That's an explanation :O thanks as always :)
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 18, 2014, 11:38:09 AM
Thank you for your explanation and time in explaining the situation. I understand that we are all volunteers and doing things only within our limited available time. I really appreciate all your helps, guides and contributions to SMF whether it relates to me or not.

But actually I do have final question with regards to your solution. If the problem truly and correctly lies in $settings['actual_theme_dir'], how will it be considered empty or otherwise, before it is included as part of $language_directories? It is already ignored while it is not empty or not supposed to be empty, thus, creates undefined index.

Please explain further, if my question does make any sense to you or anybody.
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 18, 2014, 11:41:03 AM
Quotef the problem truly and correctly lies in $settings['actual_theme_dir'], how will it be considered empty or otherwise,

That's just it.

It shouldn't be empty. It should always be declared. And for some random reason it ends up not being declared while still making it to that code.

And when it is not declared, it ends up throwing an error.
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 18, 2014, 12:30:56 PM
So the code check the $settings['actual_theme_dir'] before adding it as part of $language_directories just to make sure it is not empty. But what if it still treat it as empty while it is not. What happen to the actual theme directory if it is actually there and it is not loaded because $settings['actual_theme_dir'] is ignored and treat as empty?

Though I would agree that it is good to add this in the SMF base distribution and fix, I want to be really clear on this. For the time being I am still thinking that it can't be SMF fault / bug unless everybody get this random error once in a while just running plain / vanilla SMF.

Based on the explanation, clearly something must have forced it to run first before its proper declaration that caused it to end up throwing that undefined index error.

So sorry if I do not make any sense to you or anybody.
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 18, 2014, 12:37:10 PM
Yes, the change I outlined simply checks it exists before it tries to use it, straight up defensive programming.

If the actual theme directory is there, then it gets used exactly as it should be. If it is not, no harm, no foul and it doesn't matter.

Again, this has already been added in the 2.1 base distribution and comes up sporadically enough that it doesn't 'need' fixing in 2.0 because the rare times it does come up, I've documented how to fix it enough that it's really not a problem.

QuoteFor the time being I am still thinking that it can't be SMF fault / bug unless everybody get this random error once in a while just running plain / vanilla SMF.

Based on the explanation, clearly something must have forced it to run first before its proper declaration that caused it to end up throwing that undefined index error.

So sorry if I do not make any sense to you or anybody.

Based on the explanation, you missed the key points I've already outlined.
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 18, 2014, 12:58:20 PM
Ok. SMF coding is complex. Please ignore what I said about that in the last part.

Quote from: Arantor on September 18, 2014, 12:37:10 PM
Yes, the change I outlined simply checks it exists before it tries to use it, straight up defensive programming.

If the actual theme directory is there, then it gets used exactly as it should be. If it is not, no harm, no foul and it doesn't matter.
I understand it won't produce any of that random undefined index if we used this fixed. But I also understand that some theme do rely on its own languages.

So I need to confirm whether can we really safely conclude there will be no harm, no foul and it doesn't matter even if there is actually another actual theme directory that is being used but it is considered as empty (as the check might fail the same as it failed earlier to detect even it is not empty)?

If that is so, it is fine with me. I just want to be clear on this. That's all.
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 18, 2014, 01:01:11 PM
QuoteI understand it won't produce any of that random undefined index if we used this fixed. But I also understand that some theme do rely on its own languages.

And none of that is actually relevant.

If the folder isn't even defined, there's no possible way it can be used in the first place...
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 18, 2014, 01:06:15 PM
Exactly my point. If I am in another theme that relies on its languages, and its language folder isn't even defined, won't that cause any undefined error?
Title: Re: Undefined index in load.php randomly
Post by: Arantor on September 18, 2014, 01:07:07 PM
*shrug* I haven't seen it happen yet.
Title: Re: Undefined index in load.php randomly
Post by: Hj Ahmad Rasyid Hj Ismail on September 18, 2014, 01:13:12 PM
I didn't mean to argue but may be I just don't understand or I don't make any sense. So, please just ignore my posts. Sorry for taking your time.