Subject : CS 11.0.0: builder preview infinite recursion (HTTP 500, “iframe response being incomplete”) when content calls the_content() , e.g. {{dc:woocommerce:product_description}} in a Looper
Hi Themeco team,
Just a message to give you a tech’ info
After updating Pro 6.9.8 to Pro 11.0.0 (Cornerstone 11.0.0), one page no longer opens in the builder. The preview shows “The preview could not load due to the iframe response being incomplete…” , and the preview POST returns HTTP 500. The front end renders that page fine, and other pages open normally in the builder.
Environment
- Pro 11.0.0 (CS 11.0.0), child theme, WordPress 7.1.5, PHP 8.5.13, WooCommerce 11.3.1, LiteSpeed (o2switch)
- The same page opened fine in the builder on Pro 6.9.8 / CS 7.9.8
Fatal error (error_log)
PHP Fatal error: Uncaught Error: Maximum call stack size of 8306688 bytes reached. Infinite recursion?
in …/themes/pro/cornerstone/includes/classes/Tss/Evaluator.php:76
The stack trace is ~29,900 frames deep, and the same cycle repeats ~217 times:
Preview->fill_content_zone() (the_content filter, PHP_INT_MAX)
└ Preview->render_zone_regions('cs_content')
└ Preview\Renderer->render_region('content') → section → row → column → … → layout-grid (Looper) → layout-cell → layout-div → text
└ cs_dynamic_content('{{dc:woocommerce:product_description}}')
└ Cornerstone_Dynamic_Content_WooCommerce->supply_field() integration/woocommerce.php:1606 → the_content()
└ apply_filters('the_content') → output_content_zone() returns the zone token → fill_content_zone() → render_zone_regions() … (again)
With Query Monitor active, the same request instead dies with “Allowed memory size exhausted” in QM’s Backtrace.php , while QM processes that huge stack.
Minimal reproduction
- Create a Page edited with Cornerstone.
- Add a Grid (or any Looper Provider) querying a few WooCommerce products, with a Looper Consumer cell inside.
- In the cell, add a Text element with the content
{{dc:woocommerce:product_description}}. - Save, then reload the page in the builder: the preview fails with HTTP 500 and the infinite recursion above. The front end is fine.
I’d expect {{dc:post:the_content}} (or anything else that calls the_content() during the render) to trigger the same loop, but I have not tested that.
Root cause (comparing 7.9.8 and 11.0.0 source)
-
7.9.8:
output_content_zone()only output an empty#cs-contentzone wrapper duringthe_content. The elements were rendered once, later, inwp_footer(output_initial_render()), outside thethe_contentfilter. A nestedthe_content()during that render could not re-enter the document render. -
11.0.0:
Services/Preview.phpaddsfill_content_zone()onthe_contentatPHP_INT_MAX(line 215). It renders the document server-side inside thethe_contentfilter, throughrender_zone_regions()→render_region().canOutputContentZone()is unchanged, so a nestedthe_content()coming from an element still gets the zone token back, andfill_content_zone()renders the content region again. - The “render once” guard in
render_zone_regions()(lines 369–374) doesn’t stop this.$this->rendered_regions[ $region ]is only set afterrender_region()returns, so a re-entrant call made during the render finds nothing stored and starts over, without end.
Suggested fix (untested): mark the region as in progress before rendering, so a re-entrant the_content() gets an empty string instead of a second render. For example, in render_zone_regions() :
if ( ! isset( $this->rendered_regions[ $region ] ) ) {
// Mark the region before rendering it, so a the_content() call made while
// its elements render (e.g. {{dc:woocommerce:product_description}}) can't
// render it again
$this->rendered_regions[ $region ] = '';
try {
$this->rendered_regions[ $region ] = $this->renderer->render_region( $region );
} catch( Exception $e ) {
$this->initial_render_error = $e->getMessage();
$this->rendered_regions[ $region ] = '';
}
}
Alternatively, output_content_zone() / fill_content_zone() could bail out while a region render is in progress, for example with a re-entrancy flag.
Workaround for now: replace {{dc:woocommerce:product_description}} with {{dc:post:the_content_raw}} inside the Looper. It reads post_content without calling the_content() , but loses wpautop and shortcodes.
I don’t know if support forum is the right channel to report a bug… but let me know if it helps you 
Also, if you think that the dynamic method I initially used is not a good practice and that the bug is a logical consequence, please let me know. Thanks.
By the way, nice shot on CS 11.0 ! it’s really smooth to use! 
Have a good day,
Florian