Publisher does not support the Fluid field type. Please do not contact asking when support will be available.
If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.
Ticket: Bloqs crash if the template is to long and you have an if-statement outside of the field
Status | Resolved |
Add-on / Version | Bloqs 3.3.1 |
Severity | |
EE Version | 3.5.14 |
Energy Schweiz AG
Jan 17, 2018Description:
If you use :total_blocks variable in an if-statement outside of the field and the template size is too big the template crashes.
Detailed steps to reproduce the issue:
1.Create a bloq element with a text input inside.
2.Create an entry with bloq elements to test the issue.
3.Create an ee template with a lot of lorem ipsum text and one bloq element. It does not matter where the bloq-code is inserted in the template. To rebuild the template, check the code snippet.
4.Call the template in the browser.
<!DOCTYPE html>
<html>
<head>
<title>Website Title</title>
</head>
<body>
{exp:channel:entries channel="your_channel_name"}
{if "{your_fieldname:total_blocks}" > "1"}TRUE{/if}
{your_fieldname}
{your_blocktype_shortname}
{your_atom_name}
{/your_blocktype_shortname}
{/your_fieldname}
[here insert your lorem ipsum text (+- 400 lines)]
{/exp:channel:entries}
</body>
</html>
BoldMinded (Brian)
This certainly seems odd. You’re saying it crashes… do you get an error message? Did you try :total_rows? What about trying the unquoted version, e.g. {if {your_fieldname:total_blocks} > 1}
BoldMinded (Brian)
Also, what is 400 “lines” of lorem ipsum. Lines aren’t really a thing on the web due to viewport width. Can you share the exact text you were using when experiencing the issue so I can use it to replicate?
Energy Schweiz AG
Thanks for your response. No there is no error message and there is no difference between the unquoted and the other version. If I use :total_rows I have still the same bug. Sorry I can’t copy my whole code inside because the lorem ipsum text is 107596 characters long but you can create the text yourself.
Energy Schweiz AG
Here is my output from my browser:
BoldMinded (Brian)
Its going to be a day or two before I can replicate this. What other add-ons do you have installed? Did you try to replicate this in a clean EE environment with no other add-ons besides Bloqs?
BoldMinded (Brian)
This is without a doubt the most puzzling bug I’ve had reported.
I’m able to replicate this locally, and based on what I’m seeing I feel like this is a deeper issue with EE’s template parsing because the Bloqs code that is supposed to parse the tag isn’t even called, so something is failing before Bloqs gets a chance to do anything with it. I’m going to report this to EllisLab and see what they say.
BoldMinded (Brian)
So you can follow https://expressionengine.com/support/bugs/23434/fieldtype-replace-tags-not-parsed-when-very-large-blocks-of-text-are-present
Energy Schweiz AG
We use these other add-ons: - ansel - channel-images - Low Seg2Cat - NavEE - stash - tag - Treasury
We found a way to temporarily fix the bug: You can create an embed and then insert your new embed into the template. With this trick the template can be parsed.
BoldMinded (Brian)
If you increase your pcre.backtrack_limit it should fix the issue. Seems a regular expression is failing inside of EE somewhere before Bloqs gets to parse the field contents. Either edit your php.ini, or add this to your .htaccess file:
Energy Schweiz AG
Thanks for your help, with your idea we were able to fix the error. We increased the pcre.backtrack_limit and now we have no problems with big templates and bloqs.