Hello mantainers,

I'm getting the error message described on title when running cron via drush and the following error message on logs:

Warning: Creating default object from empty value in boxes_box::load() (line 28 of /sites/all/modules/boxes/plugins/boxes_box.inc).

The code is as follows:


  public static function load($delta, $reset = FALSE) {
    if (!isset(self::$boxes[$delta]) || $reset) {
      ctools_include('export');
      $box = ctools_export_load_object('box', 'names', array($delta));
      if (!empty($box) && $values = array_pop($box)) {
        self::$boxes[$delta] = self::factory($values->plugin_key, $values);
        self::$boxes[$delta]->new = FALSE; // Line 28
      }
    }
    return isset(self::$boxes[$delta]) && get_class(self::$boxes[$delta]) != 'stdClass' ? self::$boxes[$delta] : NULL;
  }

I see that this error was supposedly fixed as described on https://drupal.org/node/1279752. Checked the code and its up to date on dev, which was updated on April 10th, 2013.

Can you give me a lead on what's the problem and/or how to fix it? Thank you for your time.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikhailian’s picture

Category: bug » support
Status: Active » Needs review
FileSize
584 bytes

I get exactly the same problem in my own profile: 4 times the message

Creating default object from empty value in boxes_box::load() (line 28 of /var/www/tinar/profiles/tinar/modules/contrib/boxes/plugins/boxes_box.inc).

The message is pretty well explain in this StackOverflow thread.

Below is a tiny patch. The syntax requires PHP 5.3+, but it's concise and easy to understand.

mikhailian’s picture

Category: support » bug
Anonymous’s picture

Issue summary: View changes
FileSize
1.49 KB

Recreated patch with PHP version check added

RoySegall’s picture

Re rolling.

Status: Needs review » Needs work

The last submitted patch, 4: default_object_empty_value-2042101-4.patch, failed testing.

kenorb’s picture

The same problem here with Boxes 7.x-1.2 when working with OpenPublic.

kenorb’s picture

Status: Needs work » Needs review
FileSize
773 bytes

Status: Needs review » Needs work

The last submitted patch, 7: default_object_empty_value-2042101-4.patch, failed testing.

mqanneh’s picture

Status: Needs work » Reviewed & tested by the community

Patch #3 worked for me.

Rob858’s picture

Patch #4 worked for me, on OpenPublic distribution (7.x-1.9).

joseph.olstad’s picture

Patch #4 looks good. Thanks

marcelovani’s picture

What are we waiting to accept this patch?

joseph.olstad’s picture

@marcelovani, we're waiting for someone like you to take over ownership of this project. here's the project ownership queue, please create an issue there.
https://www.drupal.org/project/issues/projectownership
look at a few issues in there, you'll see how it's done.