ElkArte Community

Elk Development => Bug Reports => Exterminated Bugs => Topic started by: txcas on March 25, 2018, 01:14:40 pm

Title: Undefined index
Post by: txcas on March 25, 2018, 01:14:40 pm
I am getting thousands of these errors since the upgrade to 1.1.2.

Notice: Undefined index: mentions

Notice: Undefined index: unread_messages
Title: Re: Undefined index
Post by: Acido on March 25, 2018, 02:00:52 pm
You are not alone, these errors are all over the place
Title: Re: Undefined index
Post by: emanuele on March 26, 2018, 07:11:24 am
Report them is the first step to have them fixed. :)
Title: Re: Undefined index
Post by: emanuele on March 26, 2018, 03:00:56 pm
That one I think it's part of:
https://github.com/elkarte/Elkarte/issues/3124
so removing:
Code: [Select]
$labels = array();
from sources/subs/PersonalMessage.subs.php will do the trick. :)

And if you have the cache enabled, then you'll need to cleanup the cache as well.
Title: Re: Undefined index
Post by: emanuele on March 26, 2018, 04:46:34 pm
https://github.com/elkarte/Elkarte/pull/3150/commits/b3c2eca714720cd0ca551ab32017f914602ec3d3
Title: Re: Undefined index
Post by: txcas on March 27, 2018, 10:21:24 am
Quote from: emanuele – That one I think it's part of:
https://github.com/elkarte/Elkarte/issues/3124
so removing:
Code: [Select]
$labels = array();
from sources/subs/PersonalMessage.subs.php will do the trick. :)

And if you have the cache enabled, then you'll need to cleanup the cache as well.
Deleting that line and clearing the cache did not get rid of the errors.

Errors are now coming from:
Notice: Undefined index: mentions
File: /home/creedmoo/public_html/sources/subs/Menu.subs.php
Line: 627

Notice: Undefined index: unread_messages
File: /home/creedmoo/public_html/sources/subs/Menu.subs.php
Line: 608

Notice: Undefined index: mentions
File: /home/creedmoo/public_html/themes/default/Theme.php
Line: 845

Notice: Undefined index: unread_messages
File: /home/creedmoo/public_html/themes/default/Theme.php
Line: 844
Title: Re: Undefined index
Post by: emanuele on March 27, 2018, 11:59:44 am
I'm not sure what I read yesterday... of course are two different things.

Would you mind including also the URL part of the error?
It doesn't need to have the domain name if you don't want, but at least everything else so that I can see where the error occurs.
Title: Re: Undefined index
Post by: txcas on March 27, 2018, 12:05:40 pm
Here are URLs:
Code: [Select]
http://www.65creedmoor.com/index.php?
http://www.65creedmoor.com/index.php?http://www.65creedmoor.com/
Title: Re: Undefined index
Post by: emanuele on March 27, 2018, 05:44:18 pm
Oook.
These are (IMO) actually two issues:
1) errors happening too early were failing very disgracefully because the database is not yet loaded,
2) the parsing of the request fails because having "http" in the query is "evil".

The first is fixed here: https://github.com/elkarte/Elkarte/commit/dfd04508ad058e2252389dfc86909bea3fd61ba0 it's a bit more than what I wanted to change for this, but this way it should be a bit more robust (I think... I hope :P).

The second... I still have to apply "the fix" because I prefer to verify a couple of things, but to me the check could very well be removed because pointless.
Title: Re: Undefined index
Post by: txcas on May 28, 2018, 11:24:41 am
I applied the fixes and deleted the cache, but I am still getting the same errors:
   txcas
Today at 10:18:07 AM
45.27.161.195
3AXM6MRDZnlU0ALdc3vltDQ19WGljOUK
Type of error: Undefined
Notice: Undefined index: mentions
http://www.65creedmoor.com/index.php?
File: /home/creedmoo/public_html/sources/subs/Menu.subs.php
Line: 627

   txcas
Today at 10:18:07 AM
45.27.161.195
3AXM6MRDZnlU0ALdc3vltDQ19WGljOUK
Type of error: Undefined
Notice: Undefined index: unread_messages
http://www.65creedmoor.com/index.php?
File: /home/creedmoo/public_html/sources/subs/Menu.subs.php
Line: 608

   txcas
Today at 10:18:07 AM
45.27.161.195
3AXM6MRDZnlU0ALdc3vltDQ19WGljOUK
Type of error: Undefined
Notice: Undefined index: mentions
http://www.65creedmoor.com/index.php?
File: /home/creedmoo/public_html/themes/default/Theme.php
Line: 845

   txcas
Today at 10:18:07 AM
45.27.161.195
3AXM6MRDZnlU0ALdc3vltDQ19WGljOUK
Type of error: Undefined
Notice: Undefined index: unread_messages
http://www.65creedmoor.com/index.php?
File: /home/creedmoo/public_html/themes/default/Theme.php
Line: 844
Title: Re: Undefined index
Post by: emanuele on May 28, 2018, 02:47:35 pm
Ohh... you have simple portal, that's an important bit.
And on top of that, you have a menu block on the front page, and that's a crucial bit.

The problem is in SP, open /sources/subs/spblocks/Menu.block.php and change:
Code: [Select]
		if (empty($context['menu_buttons']))
{
setupMenuContext();
}
to:
Code: [Select]
		if (empty($context['menu_buttons']))
{
setupThemeContext();
setupMenuContext();
}

@Spuds that's for you! :D
Title: Re: Undefined index
Post by: Spuds on May 28, 2018, 03:06:34 pm
Done .. thanks !
Title: Re: Undefined index
Post by: txcas on May 29, 2018, 10:53:46 am
Thanks guys. The SP fix took care of the errors.