Hello all,
This is possibly a quirk of the site I'm working on, but I'm suffering the following 2 fatal PHP errors when trying to configure the Boxes block at admin/build/block/configure/boxes/boxes_add__simple:
Fatal error: Call to a member function get() on a non-object in boxes.module on line 513
On save, I also get this:
Fatal error: Call to a member function save() on a non-object in boxes.module on line 94
The following two adjustments seem to fix the errors to at least make things appear to work, but I'm guessing this might be symptomatic of a deeper issue with the site I'm working on. However, the block configuration is saving fine. While I appreciate I'm an edge case, could these patches be considered for inclusion as they're so simple and shouldn't compromise the module at all?
Many thanks,
Alex
(These patches are for 6.x-1.x-beta9):
boxes.module, line 91
Old:
case 'save':
$edit['delta'] = $delta;
$box = boxes_factory($edit['plugin_key'], $edit);
$box->save();
break;
New:
case 'save':
$edit['delta'] = $delta;
$box = boxes_factory($edit['plugin_key'], $edit);
if (is_object($box)) {
$box->save();
}
break;
boxes.module, line 513:
Old:
function boxes_boxes_load_alter(&$box, $delta) {
if (module_exists('spaces') && $space = spaces_get_space()) {
if ($space_box = $space->controllers->boxes->get($delta)) {
New:
function boxes_boxes_load_alter(&$box, $delta) {
if (module_exists('spaces') && ($space = spaces_get_space()) && is_object($delta)) {
if ($space_box = $space->controllers->boxes->get($delta)) {
Comments
Comment #1
alexgreyhead commentedThis is also happening at line 315. Old code:
New code:
Comment #2
henrijs.seso commentedmore in boxes_context_block_info_alter if spaces module is used. And then some when box is dropped in region after JS saves box content. What would be underlying problem?
Comment #3
henrijs.seso commentedso, accordingly
Comment #4
cmcintosh commentedI am seeing this issue on various spaces when I enable Boxes and go to a page that previous was working is now broken. In order to correct this I edited the block.module and added a check to it for the foreach loop. However if you then go to the overrides control for a space you also get this error.
Comment #5
ttaylor797 commentedI am getting the same thing with Drupal 6.20, Boxes 6.x-1.0, Chaos tools 6.x-1.8, and Spaces 6.x-3.0.
Here is the dtools output on the WSOD error:
I will try the above to see if it works.