This topic was marked solved by its starter, on February 5th, 2014, 12:48 AM
Just emptied the boards table and got an error

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Just emptied the boards table and got an error
« on June 29th, 2013, 09:43 AM »

Notice: Undefined offset: 0 in I:\www\wedge\trunk\Sources\Subs-BoardIndex.php on line 476


The mod category still shows up just fine.

Will this happen to some crazy person other than me?
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Just emptied the boards table and got an error
« Reply #3, on June 29th, 2013, 08:31 PM »
Ah, yes, I see the problem and it will affect anyone. If there's a situation where you're viewing the board index without any visible categories it'll throw the error. And if there's no visible boards, there's no visible categories.

Code: [Select]
if ($key == -1)
{
$cats = array_keys($categories);
$key = $cats[0];
$after = false;
}

$categories = array_insert($categories, $key, $thiscat, $after);

is the current code... I'm guessing it should be:
Code: [Select]
if ($key == -1)
{
$cats = array_keys($categories);
$key = !empty($cats) ? $cats[0] : 0;
$after = false;
}

$categories = array_insert($categories, $key, $thiscat, $after);

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Re: Just emptied the boards table and got an error
« Reply #5, on February 4th, 2014, 06:46 AM »
Quote from Arantor on June 29th, 2013, 08:31 PM
Ah, yes, I see the problem and it will affect anyone. If there's a situation where you're viewing the board index without any visible categories it'll throw the error. And if there's no visible boards, there's no visible categories.

Code: [Select]
if ($key == -1)
{
$cats = array_keys($categories);
$key = $cats[0];
$after = false;
}

$categories = array_insert($categories, $key, $thiscat, $after);

is the current code... I'm guessing it should be:
Code: [Select]
if ($key == -1)
{
$cats = array_keys($categories);
$key = !empty($cats) ? $cats[0] : 0;
$after = false;
}

$categories = array_insert($categories, $key, $thiscat, $after);
Is this now in the codebase? I'm in the middle of rebuilding my localhost so can't check atm...

Nao

  • Dadman with a boy
  • Posts: 16,080
Re: Just emptied the boards table and got an error
« Reply #6, on February 4th, 2014, 11:13 AM »
To me, this looks like code that's only in the pseudo-board stuff, i.e. moderation quicklinks...
There's only one line to change, I just changed it because it's basically a free one, but... Well, at least it should fix your error at that line number.
It'll be in my next commit!