Skip Navigation

[Resolved] Forms error

This thread is resolved. Here is a description of the problem and solution.

Problem:

The user encounters a blank page instead of an expected edit form after updating PHP to version 8.0.28. They need to fix the issue, as their hosting provider will be upgrading to PHP 8.

Solution:

The issue was caused by incorrect usage of the [cred_show_group] shortcode, which should be used for conditional display based on fields added to the form. The user was using the [wpv-search-term] shortcode with [cred_show_group]. The recommended solution was to replace the [cred_show_group] with [wpv-conditional] shortcode wherever the [wpv-search-term] shortcode was used in the form.

Relevant Documentation:

Toolset Forms Conditional Display Engine:

https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/

WPV-Conditional shortcode documentation:

https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-conditional

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

This topic contains 10 replies, has 2 voices.

Last updated by umbertoZ 1 year, 8 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2563235

Hi, I'm getting a blank page where I expect an edit form. This happened after updating PHP to version 8.0.28.

You can see the form here:

/informe/informe-de-supervision-tecnica-independiente-18-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2-2/?content-template-id=1157&paso=1

This is the error log:

Warning: Undefined array key "1147_condition_ef777cab725ef2b6254bbeb3e4e68b48" in /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 263

Warning: Trying to access array offset on value of type null in /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 263

Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php:325 Stack trace: #0 /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php(325): array_map('serialize', NULL) #1 /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php(263): WPToolset_Forms_Conditional->array_unique_md(NULL) #2 /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php(302): WPToolset_Forms_Conditional->_parseData() #3 /www/public/wp-includes/class-wp-hook.php(308): WPToolset_Forms_Conditional->get_partial_data(Array) #4 /www/public/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array) #5 /www/public/wp-content/plugins/cred-frontend-editor/application/controllers/form_rendering.php(594): apply_filters('wptoolset_forms...', Array) #6 /www/public/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(834): CRED_Form_Rendering->render() #7 /www/public/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(410): CRED_Form_Base->do_render_form() #8 /www/public/wp-content/plugins/cred-frontend-editor/application/controllers/form_builder_base.php(44): CRED_Form_Base->print_form() #9 /www/public/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php(1774): CRED_Form_Builder_Base->get_form(1147, '') #10 /www/public/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php(2373): CRED_Helper::cred_form('editar-informes...', '') #11 /www/public/wp-includes/shortcodes.php(355): CRED_Helper::credFormShortcode(Array, '', 'cred-form') #12 [internal function]: do_shortcode_tag(Array) #13 /www/public/wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(cred\\-...', 'do_shortcode_ta...', '\n<div class="wp...') #14 /www/public/wp-includes/class-wp-hook.php(308): do_shortcode('\n<div class="wp...') #15 /www/public/wp-includes/plugin.php(205): WP_Hook->apply_filters('\n<div class="wp...', Array) #16 /www/public/wp-includes/post-template.php(255): apply_filters('the_content', '') #17 /www/public/wp-content/themes/buddyboss-theme/template-parts/content.php(158): the_content('Continue readin...') #18 /www/public/wp-includes/template.php(785): require('/www/app...') #19 /www/public/wp-includes/template.php(718): load_template('/www/app...', false, Array) #20 /www/public/wp-includes/general-template.php(204): locate_template(Array, true, false, Array) #21 /www/public/wp-content/themes/buddyboss-theme/inc/theme/template-functions.php(729): get_template_part('template-parts/...', 'informe') #22 /www/public/wp-includes/class-wp-hook.php(308): buddyboss_theme_single_template_part_content('informe') #23 /www/public/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #24 /www/public/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #25 /www/public/wp-content/themes/buddyboss-theme/single.php(32): do_action('buddyboss_theme...', 'informe') #26 /www/public/wp-includes/template-loader.php(106): include('/www/app...') #27 /www/public/wp-blog-header.php(19): require_once('/www/app...') #28 /www/public/index.php(17): require('/www/app...') #29 {main} thrown in /www/public/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 325

#2563663

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for the info, as I do not want to deactivate something on a live website, would you please follow the steps below?

- IMPORTANT STEP! Create a backup of your website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.

I ask about that as I had the same scenario here and the steps above were the solution to find the culprit:

https://toolset.com/forums/topic/wordpress-built-in-feature-detected-when-a-plugin-caused-a-fatal-error/

And yes it was showing the issue on PHP 8.

Thanks.

#2563709

Hi Christopher, I've done those test by myself (I've deactivated all the plugins and I've set Twenty Twenty-Two theme), I still get the problem.

You can make tests on the live site, because this website isn't a public tool and now in Colombia it's night, so the users are now working with it.

We also have a backup of this morning on Kinsta. I've also installed Duplicator and I've created a package for you:

/wp-admin/admin.php?page=duplicator

cheers

#2564715

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you. Unfortunately, the username that you shared is not administrator, so I can not even access the Toolset menus and not the duplicator package.

Would you please provide an administrator role so I can move the website to our server and start troubleshooting?

Thanks.

#2564737

Hey, sorry for the mistake. Now it is an Administrator. Try again with the same login user.

cheers

#2565501

Hi, is there any update about this error?
For us it is urgent to fix the problem. We could downgrade Kinsta to PHP 7, now forms work fine, but kinsta said that they will upgrade it again on Monday, they force the upgrade of all their hosting to PHP 8.

#2565705

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Yes, we are doing our best. I managed to move your website to our server which is PHP 8 and we are checking the details.

#2565733

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

I am going to ask the second-tier to take a look into the issue but it will take time as they will be online on Monday and it will take time for troubleshooting.

My troubleshooting result is that the issue is happening in cred_show_group shortcode. As soon as I remove all instances of that shortcode the form works.

In the documentation of that I see that you need to have a variable:

https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/

But you used shortcodes inside the condition of them. Maybe the PHP 8.0 is more picky regarding that and you need to wrap them as a variable.

Please test that and see if it works for you.

#2566675

Hi, thanks for the advice. I don't understand what you mean with "But you used shortcodes inside the condition of them".

Can you explain it?

Can I use [wpv-conditional] instead of [cred_show_group]?

As you have seen, I'm using [wpv-search-term param='paso'] to display or not the form fields. My goal is to build a multi step form.
Can you advice me on a different way to check it or a different way to build a multi step form?

thanks
Umberto

#2566805

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

I have an answer from the second-tier:

It seems user is using the [cred_show_group] shortcode wrong way as the [cred_show_group] shortcode should be used to display conditional display based on the fields added to the form.

User is using the [wpv-search-term] shortcode with [cred_show_group], you should try to replace the [cred_show_group] with [wpv-conditoinal] shortcode wherever [wpv-search-term] shortcode is used in your form.

So please replace the shortcodes there and it should work.

#2567495

My issue is resolved now. I've changed the conditionals and now everything works fine with PHP8.

Thank you!