Skip to main content
Topic: Undefined Error When Search By Guest (Read 2352 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Undefined Error When Search By Guest

I got an undefined error when forum is searched by a guest but not really sure what causing it. Any help will be appreciated.
Code: [Select]
Guest
15.02.16 | 11:02:03 PM
162.216.19.183 
1442be50399fd9e0399b000867799598
Type of error: Undefined
8: Undefined offset: 1
URL http://192.168.0.111/index.php?amp;action=search
File: /var/www/clients/client3/web34/web/themes/default/GenericBoards.template.php
Line: 55


Code: [Select]
39:			// The +1 here are to take in consideration category headers
40: // that visuallt account for about one additional board
41: $group_totals[$current_group] += $boards_count + 1;
42: $current_streak += $boards_count + 1;
43:
44: // Start a new streak
45: if ($current_streak > $optimal_boards && $current_group < ($num_groups - 1))
46: {
47: $current_streak = 0;
48: $current_group++;
49: $groups[$current_group] = array();
50: $group_totals[$current_group] = 0;
51: }
52: }
53:
54: // The current difference of elements from left and right
==>55: $diff_current = $group_totals[0] - $group_totals[1];
56:
57: // If we have less on the right, let's try picking one from the left
58: if ($diff_current > 0)
59: {
60: $last_group = array_pop($groups[0]);
61: // Same as above, +1 for cat header
62: $diff_alternate = $diff_current - 2 * ($categories[$last_group] + 1);
63:
64: if (abs($diff_alternate) < $diff_current)
65: array_unshift($groups[1], $last_group);
66: else
67: $groups[0][] = $last_group;
68: }
69: // If we have less on the left, let's try picking one from the right
70: elseif ($diff_current < 0)
71: {
72: $first_group = array_shift($groups[1]);
73: // Same as above, +1 for cat header
74: $diff_alternate = $diff_current + 2 * ($categories[$first_group] + 1);

Re: Undefined Error When Search By Guest

Reply #1

Are you on a localhost?
Bugs creator.
Features destroyer.
Template killer.

Re: Undefined Error When Search By Guest

Reply #2

Not really. This site is a live site but I could access it via local ip address as well. That is by using subforum addon. By the guest ip is definitely not local.

Re: Undefined Error When Search By Guest

Reply #3

Ohh now I see.
Could it be you have only one or two visible boards?
I think changing this:
Code: [Select]
$group_totals = array(0 => 0);
to:
Code: [Select]
$group_totals = array(0 => 0, 1 => 0);
will do (at least for the time being).
Bugs creator.
Features destroyer.
Template killer.

Re: Undefined Error When Search By Guest

Reply #4

I tested the code and the error is now gone for searches in forum(s) without any board but just link(s). Thank you.

Re: Undefined Error When Search By Guest

Reply #5

Should this be tracked? @emanuele
~ SimplePortal Support Team ~

Re: Undefined Error When Search By Guest

Reply #6

Quote from: ahrasis – I tested the code and the error is now gone for searches in forum(s) without any board but just link(s). Thank you.
So there is no "real" boards, just redirects?
Bugs creator.
Features destroyer.
Template killer.

Re: Undefined Error When Search By Guest

Reply #7

Yup. There is no board for one of the sub forums, just redirect(s).

Re: Undefined Error When Search By Guest

Reply #8

Makes sense, I never accounted for this situation.
Yep, to be fixed in one of the next revisions, I'll move to bug reports.
Bugs creator.
Features destroyer.
Template killer.

Re: Undefined Error When Search By Guest

Reply #9

Can't find the commit, but it's fixed.
Bugs creator.
Features destroyer.
Template killer.