Skip Navigation

[Resolved] CONFLICT WITH PHP7 and AVADA THEME

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 20 replies, has 2 voices.

Last updated by Nigel 6 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#595171

Test #1 works fine however Test #2 fails which start displaying the avada shortcodes and nothing else gets rendered within that conditional.

#595176

Here is something interesting I found:

TEST#3 - WORKING - NO NEWLINES

[wpv-conditional if="( '1' eq '1' )"]

[fusion_builder_container hundred_percent="no" hundred_percent_height="no" hundred_percent_height_scroll="no" hundred_percent_height_center_content="yes" equal_height_columns="no" menu_anchor="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="center center" background_repeat="no-repeat" fade="no" background_parallax="none" enable_mobile="no" parallax_speed="0.3" video_mp4="" video_webm="" video_ogv="" video_url="" video_aspect_ratio="16:9" video_loop="yes" video_mute="yes" video_preview_image="" border_size="" border_color="" border_style="solid" margin_top="" margin_bottom="" padding_top="" padding_right="" padding_bottom="" padding_left=""][fusion_builder_row][fusion_builder_column type="1_6" layout="1_6" spacing="" center_content="no" link="" target="_self" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" hover_type="none" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"][/fusion_builder_column][fusion_builder_column type="2_3" layout="2_3" spacing="" center_content="no" link="" target="_self" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" hover_type="none" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"][fusion_title hide_pop_tinymce="" margin_top="" margin_bottom="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" size="1" content_align="left" style_type="default" sep_color=""]Here is my awesome title[/fusion_title][/fusion_builder_column][fusion_builder_column type="1_6" layout="1_6" spacing="" center_content="no" link="" target="_self" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" hover_type="none" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

[/wpv-conditional] 

TEST#4 - NOT WORKING - WITH NEWLINES

[wpv-conditional if="( '1' eq '1' )"]

[fusion_builder_container hundred_percent="no" hundred_percent_height="no" hundred_percent_height_scroll="no" hundred_percent_height_center_content="yes" equal_height_columns="no" menu_anchor="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="center center" background_repeat="no-repeat" fade="no" background_parallax="none" enable_mobile="no" parallax_speed="0.3" video_mp4="" video_webm="" video_ogv="" video_url="" video_aspect_ratio="16:9" video_loop="yes" video_mute="yes" video_preview_image="" border_size="" border_color="" border_style="solid" margin_top="" margin_bottom="" padding_top="" padding_right="" padding_bottom="" padding_left=""][fusion_builder_row][fusion_builder_column type="1_6" layout="1_6" spacing="" center_content="no" link="" target="_self" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" hover_type="none" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"][/fusion_builder_column][fusion_builder_column type="2_3" layout="2_3" spacing="" center_content="no" link="" target="_self" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" hover_type="none" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"][fusion_title hide_pop_tinymce="" margin_top="" margin_bottom="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" size="1" content_align="left" style_type="default" sep_color=""]

Here is my awesome title

[/fusion_title][/fusion_builder_column][fusion_builder_column type="1_6" layout="1_6" spacing="" center_content="no" link="" target="_self" min_height="" hide_on_mobile="small-visibility,medium-visibility,large-visibility" class="" id="" background_color="" background_image="" background_position="left top" background_repeat="no-repeat" hover_type="none" border_size="0" border_color="" border_style="solid" border_position="all" padding="" dimension_margin="" animation_type="" animation_direction="left" animation_speed="0.3" animation_offset="" last="no"][/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

[/wpv-conditional] 

Strange that some extra spacing is causing the page to malfunction.

#595604

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Amit

Thanks for sharing your test results.

I tried the same on my site and I was able to reproduce the problem with tests #1, #2, and #4. The only test which correctly rendered the title was #3.

I've passed these on to my colleague to see if he can use these to get to the bottom of the problem.

Thanks again for your patience.

#595850

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Amit

We have made some progress in identifying the problem, but I'm afraid it's not exactly good news.

The content in between the opening and closing wpv-conditional shortcodes needs to be searched using regular expressions to allow for the fact that nested conditional shortcodes may be included.

PHP7 introduced new restrictions and errors with regular expressions that weren't present in PHP5.

Lengthy content inside the conditional shortcodes can trigger these errors (specifically, a PREG_JIT_STACKLIMIT_ERROR).

The regular expressions have been reviewed and there is no scope for optimising them further to prevent such an error. Our developers are trying to identify other possible solutions, but at the moment don't have one.

The content of your conditionals is so lengthy because they wrap around the verbose fusion shortcodes.

To me it seems there are two possible solutions you can use right now.

One is to move the conditional shortcodes inside fusion builder rather than outside as you have it now. So where you have content inside a row that you want to conditionally display, more the condition inside the text module that outputs the content itself. (This is actually the expected use.)

That will output all of the rows, some of which will simply be empty according to the conditions.

Alternatively, the second option would be to create unassigned Content Templates for the individual sections, which you can design with Fusion Builder, and then edit the master template and continue to use the conditional shortcodes before and insert these templates in between the shortcodes so that they contain just a wpv-post body shortcode rather than the lengthy fusion shortcodes that they currently do.

Sorry for the extra work this implies, but it is something that the changes in PHP7 necessitate when working with conditionals that wrap lengthy blocks of content.

Let me know how you get on.

#595922

Hello,
Unfortunately this is not-so-good news about PHP7 compatability. You gave some good suggestions that might work for some scenarios. However, not for all. Example, if we have a 2 column section, and for some pages, we only have content for the left column, showing a 2 column section with only the left-side filled out doesn't make sense.

Instead, it makes more sense to have that content in a center full-width column. We use the conditionals to structurly make the page DYNAMIC and not break if one of our writers doesn't fill out content for a particular page. Just like you would do in a PHP template. Correct?

Following your suggestions, we'd have to create 20 template variations to cover all possibilities. That's not feasible to manage or keep track of changes etc..

We would like 1 template, where we can dynamically structure the content.

What other solution can you provide other than the one you mentioned?

Thanks
Amit

#595934

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

There are currently only 3 options.

1. The issue was introduced in PHP 7 > Use PHP 5.6
2. If you have access to the php.ini file on your server, you can disable PCRE JIT (which introduced the issue) by adding the following:

[Pcre]
pcre.jit= 0

If there is already a section with prce.jit in your php.ini file, make sure this comes below it.

3. Make your conditional sections simpler.

There is, admittedly, more work breaking your current Content Template into smaller templates that you selectively include inside conditional shortcodes, but you are not introducing any new permutations or combinations than in your current template, simply extracting the same options into different templates, and it would have the side effect of making your main template much more readable than it currently is.

The developers don't have another solution at present, I'm afraid, we are currently limited to those three. They will try and find another, but it may require quite a rethink on how conditional shortcodes work to circumvent the issue introduced with complex regular expressions in PHP 7.

#596039

So if we disable PCRE JIT - it should work fine? Can you test if it does so I can ask my hosting to do this? Thanks!

#596046

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Our developer tried it on his own server environment and it worked, but the only way to know for sure out in the wild is to try it and see.

Please let us know.