I see this issue in the most recent dev version. This is related to column widths not being set. These should space out according to the code but the statement to set that value (line 418) if after the request to retrieve them (line 386) . I fixed it on my side by moving the if statement ahead of the sort/set statement. Here is a sample:

  // If custom widths aren't set, make each width a percentage of the total available.
  if (!count($page->settings['widths'])) {
    $num_regions = count($regions);
    for ($i = 1; $i <= $num_regions; $i++) {
      // We use a combination of round() and floor() to get this rounded to two decimal places
      // since the $mode argument isn't introducted into round() until PHP 5.3.0.
      $page->settings['widths'][$i] = round(floor((100 / $num_regions) * 100) / 100, 2);
    }
  }


  // Sort each region/column based on key value
  // Also separate the regions into rows based on the region widths
  $sum_width = 0;
  $row = 0;
  for ($i = 1; $i <= count($regions); $i++) {
    ksort($regions[$i]);
    $sum_width += $page->settings['widths'][$i];
    if ($sum_width > 100) {
      $row++;
      $sum_width = 0;
    }
    $page->settings['rows'][$i] = $row;
  }

Comments

djdevin’s picture

I can confirm this happening.

chaby’s picture

Status: Active » Needs review
StatusFileSize
new1.59 KB

same issue too. Thanks mastermindg, i reroll your fix in this patch.

At the beginning, i was asking :

- why do it after ? Is there is a reason to give a page with an empty settings['width'] if user is logged to "homebox_add_link()" and form "homebox_save_form" ? Obviously not ! Maybe a wrong merge...

Anyway, i think it could fix this issue.

cehfisher’s picture

I can confirm that the patch in #2 works on the 7.x-2.0-beta6+17-dev version of homebox. Thanks!

cehfisher’s picture

Issue summary: View changes

Fixed php wrap

robbertnl’s picture

#2 also works for 7.x-2.0-beta7

mgifford’s picture

#2 still applies nicely to the git repo. Seems to work fine in simplytest.me. No errors that I could see.

Any reason not to mark this RTBC?

maximpodorov’s picture

The same issue: #1634486: After adding new hombox: undefined offset
Which solution is better?

mgifford’s picture

There seems to be no new code in this issue. The other issue adds an if() to check if the value exists.

For that reason, I'd say that this one is better as it's got some slight performance improvements.

richH’s picture

Version: 7.x-2.x-dev » 7.x-2.0-beta7
Issue summary: View changes
Status: Needs review » Active

Hi,

I just installed Homebox and have this error:

Notice: Undefined offset: 1 in homebox_build() (line 398 of sites/all/modules/homebox/homebox.module).
Notice: Undefined offset: 2 in homebox_build() (line 398 of sites/all/modules/homebox/homebox.module).
Notice: Undefined offset: 3 in homebox_build() (line 398 of sites/all/modules/homebox/homebox.module).

All other modules are up to date including core (7.28). All I did was install homebox and add some blocks. Nothing fancy!

Thanks
Rich

andrewsizz’s picture

StatusFileSize
new1.59 KB

add reroll

mgifford’s picture

Status: Active » Needs review
VasilyKraev’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. Works fine for me.

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed!

  • drumm committed d8fef58 on 7.x-2.x authored by AndrewsizZ
    #2015203 Fix Undefined offset: 1 in homebox_build()
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.