I've installed Ajax Blocks to accompany the UC Block and allow page caching to run (page caching broke the ubercart block without Ajax Blocks installed).

Problem is, after about an hour of having page caching turned on, some of our pages start to display a white screen with only the following text -

{"uc_cart-cart":{"content":"\u003cp class=\"cart-block-items collapsed\"\u003eThere are no products in your shopping cart.\u003c\/p\u003e\u003ctable class=\"cart-block-summary\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class=\"cart-block-summary-items\"\u003e\u003cspan class=\"num-items\"\u003e0\u003c\/span\u003e\u003c\/td\u003e\u003ctd class=\"cart-block-summary-total\"\u003e\u003clabel\u003eTotal:\u003c\/label\u003e \u003cspan class=\"uc-price\"\u003e$0.00\u003c\/span\u003e\u003c\/td\u003e\u003c\/tr\u003e\u003c\/tbody\u003e\u003c\/table\u003e","ajaxblocks_settings":""}}

I have no idea how to troubleshoot this but it only occurs when I turn on Ajax Blocks, apply it to the Ubercart Block, show on every page, AND turn on Page Caching.

Any advice would be amazing, thanks.

Comments

maximpodorov’s picture

Could you try Drupal 7.12? It contain fixes for JSON encoding.

seagle’s picture

I upgraded to 7.12 and still receive that same blank page with the following JSON string:

{"uc_cart-cart":{"content":"\u003cp class=\"cart-block-items collapsed\"\u003eThere are no products in your shopping cart.\u003c\/p\u003e\u003ctable class=\"cart-block-summary\"\u003e\u003ctbody\u003e\u003ctr\u003e\u003ctd class=\"cart-block-summary-items\"\u003e\u003cspan class=\"num-items\"\u003e0\u003c\/span\u003e\u003c\/td\u003e\u003ctd class=\"cart-block-summary-total\"\u003e\u003clabel\u003eTotal:\u003c\/label\u003e \u003cspan class=\"uc-price\"\u003e$0.00\u003c\/span\u003e\u003c\/td\u003e\u003c\/tr\u003e\u003c\/tbody\u003e\u003c\/table\u003e","ajaxblocks_settings":""}}

Very strange indeed. This keeps me from being able to use page caching.

trup’s picture

такой же баг на 7.10. обновился до 7.12, без разницы.
даже на страницах типа /sitemap или /user. но если ссылка заканчивается слешем, то бага нет. по крайней мере, мне не удалось его воспроизвести ни разу на ссылках заканчивающихся слешем. только на тех, которые слешем не заканчиваются.
в моём случае, на сайте зарегистрирован только админ и включено кеширование для анонимов. под админом бага нет, только под анонимом.
так же, баг проявляется не в 100% случаев, но довольно часто. я бы сказал 50%/50%.

seagle’s picture

Version: 7.x-1.x-dev » 7.x-1.2

google translated - "is the same bug on 7.10. updated to 7.12, with no difference.
even in the pages of the type / sitemap or the / user. but if the link ends with a slash, then the bug does not. At least, I could not play it even once in the references ending slash. only to those who do not end slash."

lance.gliser’s picture

Category: support » bug
Priority: Normal » Major

Appears to be a caching issue.
I looked through the code, and you seem to set the server's internal url to the referring url, then ouput the page. This makes Drupal think you're feeding a different version of the referring url's page, and it caches it because you haven't disabled caching for the request.

Easiest fix I found was to alter function ajaxblocks_ajax_handler().
Anywhere in the function, place this line of code: drupal_page_is_cacheable(FALSE);

lance.gliser’s picture

Status: Active » Needs review
trup’s picture

it works!
thanks.

maximpodorov’s picture

@lance.gliser
Looks like you are right. Thank you very much!
In 6.x version, ajaxblocks.module contains ajax handler which ends on:

ajaxblocks_json($content);
exit;
}

and in 7.x:

drupal_json_output($content);
}

So no caching is possible in 6.x.
I'll publish new version soon.
Thank you again.

lance.gliser’s picture

Status: Needs review » Reviewed & tested by the community
maximpodorov’s picture

seagle’s picture

Working for me, thanks so much!

maximpodorov’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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