News:

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

Main Menu

Too many error logs

Started by ninik, December 05, 2017, 12:15:58 PM

Previous topic - Next topic

ninik

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:



'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

Sir Osis of Liver

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
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

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.


Sir Osis of Liver

If you just want to eliminate the errors, you can make some fudge -



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
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Suki

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
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik

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...

Suki

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik

I just did attach it in my above post

Suki

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:



//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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik

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:



<?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.

Illori

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.

ninik

OK, got it... and thank you Illori  :)

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

Illori

check if it already exists in the file first.

ninik

Hi Illori,

no, the function


checkNotify();


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

Illori

then add it before the closing ?>

ninik

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):


8: Undefined index:

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




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:



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


// 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.


?>

Suki

Add it where the parser indicates, before this line:

// Attachments don't require the entire theme to be loaded.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

ninik

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

Sir Osis of Liver

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.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

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?


//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?

Shambles

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:

<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...

ninik

Hi shambles,

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

Sir Osis of Liver

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?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

yes the mode works fine and  practically with no issues...

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

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!!!  :)

Suki

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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Sir Osis of Liver

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.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

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:


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.

Sir Osis of Liver

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. 
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

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?

Sir Osis of Liver

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.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

ninik

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! :)

Advertisement: