I have just installed the context module and haven't setup anything as yet. After doing this the site refused to load. I had a look in the error log and saw the following.

PHP Fatal error: Call to a member function block_list() on a non-object in /home/beta/html/sites/all/themes/fusion/fusion_core/template.php on line 327

Lines 326 to 328 are below

$context = context_get_plugin('reaction', 'block');
$context_list = $context->block_list($region);
$drupal_list = array_merge($context_list, $drupal_list);

It seems that context_get_plugin is not returning an object when there isn't anything available. The problem is that because of this the next line causes the fatal error.

Can you please update this code to the following.

$context = context_get_plugin('reaction', 'block');
if (is_object($context)) {
  $context_list = $context->block_list($region);
  $drupal_list = array_merge($context_list, $drupal_list);
}

As you can see this just checks to make sure that $context is an object before it is treated as an object.

Comments

akoepke’s picture

Title: fusion_core_block_list causes fatal error due with Context module » fusion_core_block_list causes fatal error with Context module
coltrane’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new953 bytes

Context does if ($plugin = context_get_plugin('condition', 'bar')) for conditionals so I did similar.

tuwebo’s picture

Looks like it is working for me!
coltrane++

aquariumtap’s picture

Status: Needs review » Reviewed & tested by the community

Marking as RTBC. I'll add this to a release shortly. Thanks!

tuwebo’s picture

Status: Reviewed & tested by the community » Needs review

Heyyyy, one second!
Don´t know if it´s something to do with this issue, but It looks like.
I have got an Ajax error when creating a variant for a panel page. I will try to resume the steps:
1 - Before apply this patch I got one panel page with no variants and the panel-page path set to /blog.
2 - I applied the patch and went back to the panel page.
3 - Started to create one variant, with constructor layout (Flexible).
4 - I added one region to the left
5 - It didn´t make it, throwing an AJAX error that didn´t let me follow to the next steps.

I deactivate the context module, then went back to the old template.php without the patch applied, and It worked. I could create the variant with the region on the left and no problems at all.

I will set status to needs review, so please test it!

esmerel’s picture

Just as a note - neither merlinofchaos or I can think of any panels issues with context and ajax errors.

aquariumtap’s picture

StatusFileSize
new28.06 KB

@akoepke - did Coltrane's patch work for you?

@aguskii - I have very little experience with Panels, but are you using the Seven administrative theme? If so, I don't believe your error has anything to do with this patch or with Fusion.

Were you getting the error message, "You must select a different layout if you wish to change layouts." See attached screenshot. Also, are you viewing the administration in Spanish? (I ask because you mentioned the "constructor" layout... it's called Builder in english)

esmerel’s picture

Status: Needs review » Postponed (maintainer needs more info)

I tried replicating this with Panels, and I'm unable to - it's working fine for me, with the patch. We need more explicit replication instructions if this is truly a problem with Fusion.

tuwebo’s picture

Hi,
I´ve been trying to replicate the error, but I couldn´t (yesterday I did it twice).

@aquiariumtap Sorry about that, yes I was viewing the administration in Spanish language (I made a mistake, the name is builder not constructor) with fusion as the administrative theme.

I have been following the same steps I did before but everything is working fine so far.
Don´t know why it didn´t work yesterday, probably for another reason.

But I will try to explain in more detail what I did (just in case).

Using: Subtheme of Fusion Starter 7.x-1.0-alpha1
Context module not installed at this point.

1 - Create a panel page (now called test) with the path set to /test (I am using multilanguage options so the path is "http://www.mysite.com/es/test").
2 - Follow the steps to create the panel panel with the Flexible Builder (with context and selection rules selected, but no rules and no contexts applied).
3 - Select the Flexible builder layout and create the variant. Then delete the default variant created. So now I have a panel page with no variants at all.
4 - Apply the patch to the template.php
5 - Install Context, Context layouts and Context UI (7.x-3.0-beta1)
6 - Went back to the admin panel pages (admin/structure/pages)
7 - Edit my test panel-page (admin/structure/pages/edit/page-test)
8 - Add new variant (admin/structure/pages/nojs/operation/page-test/actions/add) - Push button Create variant
9 - (admin/structure/pages/nojs/operation/page-test/actions/configure) - Click continue button
10 (admin/structure/pages/nojs/operation/page-test/actions/configure/context) - Didn´t choose anything - Click continue button
11 - Select Flexibel Builder - (admin/structure/pages/nojs/operation/page-test/actions/configure/choose) - Continue button
12 - Add css id "test" - (admin/structure/pages/nojs/operation/page-test/actions/configure/settings) - Click continue button
13 - In this screen I push the button "Show layout designer", then I selected Row, "Add region to the left" (admin/structure/pages/nojs/operation/page-test/actions/configure/content) - AT THIS POINT -> The overlayed screen with the "Region title", "CSS class" and "With (Fluid or fixed)" didn´t showed up. Instead I got the overlayed screen pulling out AJAX error with lots of messages like @import css.... and many more (sorry but I didn´t got a screen capture).

Now It is WORKING FINE with no errors at all.

So... sorry everybody if I waste your time, but yesterday I did it all the process twice and both times I got the error...

So:
coltrane+++
aguskii ----

Thanks everybody!

akoepke’s picture

Hi guys,

I actually decided not to use the Context module in the end so can't really offer any testing anymore. I was advised to check it out as it may have had some benefits for the project I was working on but found that other modules already met our needs and it didn't offer us any advantages (just more code to be parsed each request)

aquariumtap’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

@aguskii, thank you for the detailed report, I'm sure it'll be helpful if this issue creeps up again!

@akoepke, thanks for the update. I'm going to mark this as close/can't reproduce for now.

beanluc’s picture

Status: Closed (cannot reproduce) » Needs review

I just got this too. Well, actually I got it 2 hours ago and have been testing and testing to reproduce it.

It appears very very simple and reliable: When Context Layouts module is enabled, and you visit a page which has any Fusion theme or subtheme, WSOD and this error comes up in the php error log.

It happened on my site with many many modules, so I did a bare install to verify. D7.7, current stable Context 7.x-3.0-beta1 (latest stable), and Fusion 7.x-1.0-alpha2

The crux seems to be specifically the Context Layouts module. Disabling that but leaving the other Context modules on removes the WSOD and the error.

nedjo’s picture

This bug is triggered by a bug in Context, which prevents the block reaction from being available immediately after context_layouts is enabled: #1297776: Blocks missing from reactions when context layouts is enabled.. So, while it's probably a good idea to apply this patch, to prevent the fatal error that's currently triggered, it won't in itself solve the problem; that will require a fix in Context.

sheena_d’s picture

Status: Needs review » Closed (won't fix)

I'm going to mark this as "wont' fix" and recommend that users follow the Context issue linked to in #13

  • Commit 0ca92f2 on master, 7.x-1.x by aquariumtap:
    Issue #1202354 submitted by @coltrane: when fetching list of blocks,...