Advertisement:

Author Topic: Too many error logs  (Read 1142 times)

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Too many error logs
« on: December 05, 2017, 12:15:58 PM »
Hi guys I have a question:

Although everything works fine in the forum, whenever someone logs in, or searches for a topic etc. I always get an error log, which is:

8: Undefined index: notify

I could locate the source of the problem in the following file:

forum/Sources/Subs-adkblog.php

in the following 2 lines:

Line: 61

Line: 63


In other words, all errors derive from these two lines.

The code of this part is the following:

Code: [Select]

'blog_notify' => array(
'title' => $txt['blog_not'].' <i>('.$context['notify'][1].')</i>',   <---- line 61
'href' => $scripturl.'?action=blog_notify',
'show' => $context['notify'][0],                                              <---- line 63
),
),
array_slice($buttons, $find_me)
);


Could anyone tell me how to resolve that issue?

Thank you in advance guys

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #1 on: December 05, 2017, 03:36:16 PM »
Errors are being caused by ADK Blog mod.  You need to take this over to the mod support topic -

https://www.simplemachines.org/community/index.php?topic=398380.0

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #2 on: December 05, 2017, 04:19:57 PM »
Hi Sir Osis of Liver,

and thank you for your reply.

Frankly speaking, I did post my question there... but nobody did post anything since February of 2017; so I am worried that I will not receive any help from over there.

Consequently, by posting it here, I did hope that someone might have encountered a similar problem and did solve it in the past.


Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #3 on: December 05, 2017, 04:33:15 PM »
If you just want to eliminate the errors, you can make some fudge -

Code: [Select]

if (!isset($context['notify'][1]))
$context['notify'][1] = '';
if (!isset($context['notify'][0]))
$context['notify'][0] = '';

'blog_notify' => array(
'title' => $txt['blog_not'].' <i>('.$context['notify'][1].')</i>',   <---- line 61
'href' => $scripturl.'?action=blog_notify',
'show' => $context['notify'][0],                                              <---- line 63
),
),
array_slice($buttons, $find_me)
);

  :P

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,085
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: Too many error logs
« Reply #4 on: December 05, 2017, 04:39:38 PM »
notify is been used without checking for its existance first. Attach that file here to see if that key is suppose to always be filled with something or if its just a programming slip
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #5 on: December 05, 2017, 05:09:14 PM »
Sir Osis of Liver, nice one... I give you that

Hi Suki, sorry but I did not quite understand which file you would like me to attach? The Subs-adkblog.php?

Edit: If so, i just did attache it...

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,085
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: Too many error logs
« Reply #6 on: December 05, 2017, 05:10:43 PM »
yes
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #7 on: December 05, 2017, 05:12:23 PM »
I just did attach it in my above post

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,085
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: Too many error logs
« Reply #8 on: December 05, 2017, 05:19:36 PM »
So, func checkNotify() define $context['notify'] and then that var is used somewhere else which means $context['notify'] indeed is suppose to always exists and have something, by default false and a zero.

The problem seems to be checkNotify() isn't been called by anyone. According to the mod's parser, that function should be called on index.php:

Code: [Select]

//Load blog's not
checkNotify();

// Attachments don't require the entire theme to be loaded.

Which is a weird place to do so but thats another matter altogether.

So, make sure you have that piece of code on your index.php file and the error should go away.
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #9 on: December 06, 2017, 09:21:38 AM »
Hi Suki,

I apologize for my late reply.

I did put the piece of code that you did provide me above in my index.php (please note: I did put it in the theme's index.php not the default's one).

Consequently, the code of the theme's index.php looks as follows:


Code: [Select]
<?php



// Try to handle it with the upper level index.php. (it should know what to do.)
if (file_exists(dirname(dirname(__FILE__)) . '/index.php'))
include (dirname(dirname(__FILE__)) . '/index.php');
else
exit;

//Load blog's not
checkNotify();

// Attachments don't require the entire theme to be loaded.

?>


Nevertheless, the problem still remains and error logs are still generated.

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,067
Re: Too many error logs
« Reply #10 on: December 06, 2017, 09:24:53 AM »
wrong place to put it. this is not a theme related issue. you need to remove it and put in the main index.php file not any other. index.php is in the same folder you will find Settings.php and SSI.php.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #11 on: December 06, 2017, 09:33:32 AM »
OK, got it... and thank you Illori  :)

Now do I put it just randomly in the index.php or in a specific section?

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,067
Re: Too many error logs
« Reply #12 on: December 06, 2017, 09:37:43 AM »
check if it already exists in the file first.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #13 on: December 06, 2017, 10:24:56 AM »
Hi Illori,

no, the function

Code: [Select]
checkNotify();

does not exist in the main index.php...

Offline Illori

  • Project Manager
  • SMF Master
  • *
  • Posts: 48,067
Re: Too many error logs
« Reply #14 on: December 06, 2017, 10:40:10 AM »
then add it before the closing ?>

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #15 on: December 06, 2017, 10:52:35 AM »
I did what you asked me to but the errors still continue.

To be more precise I still get the following 2 error logs (as seen below):

Code: [Select]
8: Undefined index:

notifyApply Filter: Only show the errors from this file File:
...Sources/Subs-adkblog.php
Line: 63

Code: [Select]

8: Undefined index: notifyApply Filter: Only show the errors from this file File:

...Sources/Subs-adkblog.php
Line: 61

and the end of the main index.php looks like this:

Code: [Select]

..............


// Fall through to the board index then...
require_once($sourcedir . '/BoardIndex.php');
return 'BoardIndex';
}

// Otherwise, it was set - so let's go to that action.
require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]);
return $actionArray[$_REQUEST['action']][1];
}

//Load blog's not
checkNotify();

// Attachments don't require the entire theme to be loaded.


?>

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,085
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: Too many error logs
« Reply #16 on: December 06, 2017, 11:00:28 AM »
Add it where the parser indicates, before this line:

// Attachments don't require the entire theme to be loaded.
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #17 on: December 06, 2017, 11:06:09 AM »
Hi Suki,

I did it but problem still remains...

I am attaching the entire index.php (the addition of the function has been made at line 197)...

Hope it helps

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #18 on: December 06, 2017, 12:37:42 PM »
Looks like index.php is correct, may be another problem in the mod.  If everything's working ok, do the fudge I posted above, it will eliminate the errors.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #19 on: December 06, 2017, 12:45:10 PM »
Hi Sir Osis of Liver,

to make sure that I did understand you correctly...

I should go into the Subs-adkblog.php

and add your piece of code right above the existing one?

Also, should I delete the following section from the index.php that I did add?

Code: [Select]
//Load blog's not
checkNotify();

// Attachments don't require the entire theme to be loaded.

As a final note:

Will this eliminate the 8: Undefined index error or will it affect all error reports?

Offline sǝๅqɯɐɥS

  • SMF Hero
  • ******
  • Posts: 4,511
  • Gender: Male
    • i30 Owners Club
Re: Too many error logs
« Reply #20 on: December 06, 2017, 12:52:08 PM »
Quote from: Sir Osis of Liver
Looks like index.php is correct ...

In the supplied index.php file there appears to be part of the installation missing:

Code: [Select]
<operation>
<search position="replace"><![CDATA[if (empty($board) && empty($topic))]]></search>
<add><![CDATA[if (empty($board) && empty($topic) && isset($_REQUEST['blog']))
{
require_once($sourcedir . '/BlogFeatures.php');
return 'BlogMain';
}
elseif (empty($board) && empty($topic))]]></add>
</operation>

Makes me wonder what else is missing/misplaced...

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #21 on: December 06, 2017, 01:28:50 PM »
Hi shambles,

so what are you proposing that I should do... follow Osis advice or what? I am confused right now?!

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #22 on: December 06, 2017, 09:48:25 PM »
Hmm, I only looked for the code Suki posted, but it does look like more of the mod code is missing.  You might try uninstalling/reinstalling it, but you'll get uninstall errors for index.php.  Does the mod work?

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #23 on: December 06, 2017, 11:36:10 PM »
yes the mode works fine and  practically with no issues...

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #24 on: December 06, 2017, 11:56:24 PM »
Try the attached index.php.

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #25 on: December 08, 2017, 12:55:23 AM »
Hi Sir Osis of Liver,

and I apologize for my delayed reply.

it appears that the error log has stop generating these undefined types of errors (in other terms, it appears as if you did resolve the issue).  :)

If I may ask, what magic did you exactly perform here and did it solve the specific issue or did it stop generating errors all together in the error log?  :)


PS: give me 24 hours to be sure that the problem has been resolved 100% and I will mark the topic as solved.

But I do indeed thank you!!!  :)

Offline Suki

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 15,085
  • Kaizoku Jotei
    • MissAllSunday on GitHub
    • SMF mods
Re: Too many error logs
« Reply #26 on: December 08, 2017, 11:02:20 AM »
The file that contains the function needed wasn't loaded by the time it was called, by including the file the function got called, the var became defined and thus the error messages were gone.
Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #27 on: December 08, 2017, 12:07:23 PM »
For reasons unknown, all of the code for that mod was missing in index.php, possibly because you at some point restored a backup from before mod was installed.


Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #28 on: December 08, 2017, 12:28:16 PM »
Hi Suki and Sir Osis of Liver,

here is how things currently stand.

Previously, the error log created constantly errors for everything. For example, if a member, or even me who is the administrator, posted something or just navigated through the forum, undefined errors would be created constantly - for every action.

The specific sections that create these problems are the once that I did mentioned in my original post.

Now, after the corrections provided by Sir Osis of Liver, undefined errors are created only for guests that try to visit the forum (as a side note: in order to enter the forum someone would have to register first - or already being a member of it). In other terms, it is something like a "closed" forum.


As stated above, errors continue to be created but now, solely for guests... and with the term guests, included are also, spammers who try to enter (hence, activation can only occur by the administrator) or bots who try to find their way into the forum but are blocked automatically.

In terms of numbers (in regards to undefined errors), the error count since my last post was 1024, now the undefined errors are 6086.

So, what would you guys suggest me to do?

PS: Sir Osis of Liver, you said:

Code: [Select]
possibly because you at some point restored a backup from before mod was installed.

Indeed, a few months ago, when I performed an update from the 2.0.13 version to the 2.0.14, the first time something went wrong and I did have to restore things from the backup.

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #29 on: December 08, 2017, 12:41:24 PM »
If you do a complete backup before making changes, and restore the backup in it's entirety, it brings you back to where you were before any changes were made.  If you try to fix a problem by selectively restoring individual files, you'll break things, and undefined index errors are a typical result.  Package manager can have problems installing/uninstalling mods that aren't exactly right, or you can install a mod with errors and the mod works, but you end up with broken bits of code, and again this can cause undefined index errors.  Best way to fix it is to upload a clean set of files, reinstall the mods, and restore any other customizations you have running. 

Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #30 on: December 08, 2017, 04:53:30 PM »
Hi Sir Osis of Liver,

I understand your suggestion and most probably this is what I am going to do. Also, I thank you for your insights.

Finally, before I proceed... should I restore the index.php the way it was before your changes or should I leave it as it is.
Thing is that in my mind (without being sure about it, of course), is to revert to the previous index.php and than proceed with uninstalling, and afterwards re-installing, the mod...

Am I thinking about it correctly?

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 7,090
  • 'Tis the gift to be simple
Re: Too many error logs
« Reply #31 on: December 08, 2017, 09:05:38 PM »
If you upload a clean set of files, index.php is included in the package, so your existing file will be overwritten with a clean one.  Just be sure you have backup copies of Settings.php and Settings_bak.php.


Offline ninik

  • Semi-Newbie
  • *
  • Posts: 74
Re: Too many error logs
« Reply #32 on: December 08, 2017, 11:05:52 PM »
OK Sir Osis of Liver, will do; and thank you  :)

Apart from it I will mark this topic as solved.

Finally, I would like to thank both Sir Osis of Liver and Suki for all the trouble you guys went through so as to assist me and help me with my issue.

Thanks again guys! :)