Advertisement:

Author Topic: undefined index  (Read 3153 times)

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,894
  • Gender: Male
  • Because Orange is Orange
undefined index
« on: January 27, 2012, 12:45:42 PM »
Not sure if it can be considered a bug or not, but accessing:
Code: [Select]
$boardurl . '/index.php?action=login2;sa=check;member={randomnumber}'two "undefined index" errors are logged:
1) 8: Undefined index: title
File: /Themes/default/Errors.template.php (body_above sub template - eval?)
Line: 422

2) 8: Undefined index: href
File: /Themes/default/Errors.template.php (body_above sub template - eval?)
Line: 421

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Kays

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,676
  • Gender: Male
    • Kayssplace
Re: undefined index
« Reply #1 on: January 27, 2012, 11:36:52 PM »
It could be. I have seen these errors reported before. Not quite sure of the circumstances behind the other reports though.

Calling that directly I can reproduce the error. At that point the user is logged in and the menu adds an empty item for the login button at the end of the button array for some reason.

Code: [Select]
home - Home - http://localhost/test2/index.php
help - Help - http://localhost/test2/index.php?action=help
search - Search - http://localhost/test2/index.php?action=search
admin - Admin - http://localhost/test2/index.php?action=admin
moderate - Moderate - http://localhost/test2/index.php?action=moderate
profile - Profile - http://localhost/test2/index.php?action=profile
pm - My Messages - http://localhost/test2/index.php?action=pm
calendar - Calendar - http://localhost/test2/index.php?action=calendar
mlist - Members - http://localhost/test2/index.php?action=mlist
logout - Logout - http://localhost/test2/index.php?action=logout;a8bdf6ec5c0=83779c4dd1ba6945060d5c1670c6aa11
login - -


Edit - Found the culprit. :)

In Subs.php look for:

Code: [Select]
$context['menu_buttons'][$current_action]['active_button'] = true;

And change it to:

Code: [Select]
if (isset($context['menu_buttons'][$current_action]))
$context['menu_buttons'][$current_action]['active_button'] = true;


Since the current action is login and the button don't exist. It will add an empty active button at the end of the array. Could be the cause of the other occurrences of this error I've noticed.

Gotta find an old thread where the OP was willing to work with me on this to confirm.
« Last Edit: January 28, 2012, 12:11:03 AM by Kays »

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,894
  • Gender: Male
  • Because Orange is Orange
Re: undefined index
« Reply #2 on: January 28, 2012, 06:04:25 AM »
Thanks Kays! :D

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Online hcfwesker

  • SMF Hero
  • ******
  • Posts: 2,023
  • Gender: Male
  • SMF 2.0.4
Re: undefined index
« Reply #3 on: January 28, 2012, 10:15:47 AM »
It could be. I have seen these errors reported before. Not quite sure of the circumstances behind the other reports though.

I'm one of the ones who have reported this.  Most common instances I see the errors are on the search page, when a member searches, then puts in another search which becomes search=2 , and the errors appear.

http://www.simplemachines.org/community/index.php?topic=420233.msg2938158#msg2938158

Also, when members are viewing membergroups in the group legend  linked on board index in the info center.

This was another support topic I tracked hoping for a fix.  http://www.simplemachines.org/community/index.php?topic=438007.msg3075724#msg3075724

My own solution was to remove this ( i know its not the right fix, but only thing i could do to stop the 100s of errors a day being made.

index.template.php
Code: [Select]
<ul>';

foreach ($childbutton['sub_buttons'] as $grandchildbutton)
echo '
<li>
<a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
<span', isset($grandchildbutton['is_last']) ? ' class="last"' : '', '>', $grandchildbutton['title'], '</span>
</a>
</li>';

echo '
« Last Edit: January 28, 2012, 10:23:38 AM by hcfwesker »

Offline Kays

  • Customizer
  • SMF Hero
  • *
  • Posts: 8,676
  • Gender: Male
    • Kayssplace
Re: undefined index
« Reply #4 on: January 28, 2012, 10:39:36 AM »
No problem. I've seen that error more than a few times and it was nice to finally be able to replicate it. :)

I did find that thread and the OP had moved the Profile button. Which resulted in the same error just for a different button this time. Basically that error will occur any time there's a $_GET['action'] and no corresponding button.

So I guess it can be considered to be a bug. :)

@hcfwesker

I think that both topics could be related to this. For the second, members report the buttons disappearing at times.

But for the first link, that scenario should covered. Unless the search button is missing.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Offline Joshua Dickerson

  • Developer
  • SMF Super Hero
  • *
  • Posts: 12,636
  • Gender: Male
    • joshuaadickerson on LinkedIn
Re: undefined index
« Reply #5 on: February 26, 2012, 10:12:37 PM »
Track it!
Need help? See the wiki. Want to help SMF? See the wiki!

Did you know you can help develop SMF? See us on Github.

How have you bettered the world today?

Offline Suki

  • SMF Super Hero
  • *******
  • Posts: 11,254
  • Kaizoku Jotei
    • Free SMF mods
Re: undefined index
« Reply #6 on: February 26, 2012, 10:49:12 PM »
just posting here so I can find it later, I was actually having this issue too, my solution was similar but it involved a rather nasty hack (lots of foreach statements), this one looks much better :)
The devil will find work for idle hands to do.

Offline Spuds

  • SMF Hero
  • ******
  • Posts: 2,046
  • Gender: Male
Re: undefined index
« Reply #7 on: February 26, 2012, 10:55:30 PM »
Should be tracked ... it was also fixed in Commit:c5553d049f7288c3bc72af3737bd9c1b0ecc7bc3 in git:development
"It is better to have tried and failed than to have failed to try, but the result's the same."
"Give me the liberty to know, to utter, and to argue freely according to conscience, above all liberties."

Offline emanuele

  • Developer
  • SMF Super Hero
  • *
  • Posts: 11,894
  • Gender: Male
  • Because Orange is Orange
Re: undefined index
« Reply #8 on: March 20, 2012, 11:37:34 AM »

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Masterd

  • SMF Hero
  • ******
  • Posts: 3,766
  • Gender: Male
Re: undefined index
« Reply #9 on: March 23, 2012, 09:35:07 AM »
I had this problem only with RC3. It never happened to me agaian.
My Mods

Sugested that too. Hey ho. I'd link you to the original discussion but it's not visible to most people (seekrit team board stuff that is more dangerous than wikileaks).


Don't PM me for support! Use the appropriate support board!