SMF Development > Fixed or Bogus Bugs

undefined index

(1/3) > >>

Not sure if it can be considered a bug or not, but accessing:

--- Code: ---$boardurl . '/index.php?action=login2;sa=check;member={randomnumber}'
--- End code ---
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

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

--- End code ---

Edit - Found the culprit. :)

In Subs.php look for:

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

--- End code ---

And change it to:

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

--- End code ---

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.

Thanks Kays! :D


--- Quote from: Kays 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.

--- End quote ---

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.

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.

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.


--- Code: --- <ul>';

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

echo '
--- End code ---

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


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.


[0] Message Index

[#] Next page

Go to full version