Navigation überspringen

[Gelöst] PHP 8.0 error

This support ticket is created vor 1 Jahr, 10 Monaten. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 11 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Minesh vor 1 Jahr, 9 Monaten.

Assistiert von: Minesh.

Author
Artikel
#2559177

I am trying to:

Run our site under PHP 8.0 with latest WordPress and Toolset plugin versions

Link to a page where the issue can be seen:

Add a listing or edit a listing

I expected to see:

The form to add or edit the listing.

Instead, I got:

Error. Switching to PHP7.4 works. This is from error_log when running PHP 8.0:

[22-Feb-2023 05:39:54 UTC] PHP Fatal error:  Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php:325
Stack trace:
#0 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php(325): array_map('serialize', NULL)
#1 /home/cmincommunity/public_html/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 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php(302): WPToolset_Forms_Conditional->_parseData()
#3 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(308): WPToolset_Forms_Conditional->get_partial_data(Array)
#4 /home/cmincommunity/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#5 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/application/controllers/form_rendering.php(594): apply_filters('wptoolset_forms...', Array)
#6 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(834): CRED_Form_Rendering->render()
#7 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/application/models/form/base.php(410): CRED_Form_Base->do_render_form()
#8 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/application/controllers/form_builder_base.php(44): CRED_Form_Base->print_form()
#9 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php(1774): CRED_Form_Builder_Base->get_form(1007, '')
#10 /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/library/toolset/cred/embedded/classes/CRED_Helper.php(2373): CRED_Helper::cred_form('edit-listing', '')
#11 /home/cmincommunity/public_html/wp-includes/shortcodes.php(355): CRED_Helper::credFormShortcode(Array, '', 'cred-form')
#12 [internal function]: do_shortcode_tag(Array)
#13 /home/cmincommunity/public_html/wp-includes/shortcodes.php(227): preg_replace_callback('/\\[(\\[?)(cred\\-...', 'do_shortcode_ta...', '\n<style>\n  \n  /...')
#14 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(308): do_shortcode('\n<style>\n  \n  /...')
#15 /home/cmincommunity/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters('\n<style>\n  \n  /...', Array)
#16 /home/cmincommunity/public_html/wp-includes/post-template.php(255): apply_filters('the_content', '')
#17 /home/cmincommunity/public_html/wp-content/themes/astra/template-parts/single/single-layout.php(47): the_content()
#18 /home/cmincommunity/public_html/wp-includes/template.php(785): require('/home/cmincommu...')
#19 /home/cmincommunity/public_html/wp-includes/template.php(718): load_template('/home/cmincommu...', false, Array)
#20 /home/cmincommunity/public_html/wp-includes/general-template.php(204): locate_template(Array, true, false, Array)
#21 /home/cmincommunity/public_html/wp-content/themes/astra/inc/template-parts.php(265): get_template_part('template-parts/...')
#22 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(308): astra_entry_content_single_template('')
#23 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#24 /home/cmincommunity/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#25 /home/cmincommunity/public_html/wp-content/themes/astra/inc/core/theme-hooks.php(443): do_action('astra_entry_con...')
#26 /home/cmincommunity/public_html/wp-content/themes/astra/template-parts/content-single.php(29): astra_entry_content_single()
#27 /home/cmincommunity/public_html/wp-includes/template.php(785): require('/home/cmincommu...')
#28 /home/cmincommunity/public_html/wp-includes/template.php(718): load_template('/home/cmincommu...', false, Array)
#29 /home/cmincommunity/public_html/wp-includes/general-template.php(204): locate_template(Array, true, false, Array)
#30 /home/cmincommunity/public_html/wp-content/themes/astra/inc/class-astra-loop.php(120): get_template_part('template-parts/...', 'single')
#31 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(308): Astra_Loop->template_parts_post('')
#32 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#33 /home/cmincommunity/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#34 /home/cmincommunity/public_html/wp-content/themes/astra/inc/class-astra-loop.php(199): do_action('astra_template_...')
#35 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(308): Astra_Loop->loop_markup('')
#36 /home/cmincommunity/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
#37 /home/cmincommunity/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#38 /home/cmincommunity/public_html/wp-content/themes/astra/inc/core/theme-hooks.php(258): do_action('astra_content_l...')
#39 /home/cmincommunity/public_html/wp-content/themes/astra/single.php(27): astra_content_loop()
#40 /home/cmincommunity/public_html/wp-includes/template-loader.php(106): include('/home/cmincommu...')
#41 /home/cmincommunity/public_html/wp-blog-header.php(19): require_once('/home/cmincommu...')
#42 /home/cmincommunity/public_html/index.php(17): require('/home/cmincommu...')
#43 {main}
  thrown in /home/cmincommunity/public_html/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/toolset-forms/classes/class.conditional.php on line 325
#2559427

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I will require admin access details and problem URL where I can see the issue with the staging site.
or
You can send me duplicator copy of your site and send me the steps that should help me to see the issue you mentioned. Can you please send me duplicator copy of your site:
=> https://toolset.com/faq/provide-supporters-copy-site/

I have set the next reply to private which means only you and I have access to it.

#2562433

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

It seems you forget to share the problem URL. Can you please send me problem URL where I can see the issue.

#2562467

As I said, you will not see the problem on our site currently because I revered to PHP8.0 so it does not affect our users. If you have restored the site to a PHP8 environment, try to add or edit a listing and you will see the problem. If you can not duplicated it, we will have to arrange a time to put the live site back on PHP8 but given how long it takes for each reply here I don't want to just leave it in that broken state.

#2562719

Sorry, I mean I reverted to PHP7.4. The problem only exists when I move to PHP8.

#2562723

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

I do not want to access or debug on your live site. I installed the duplicator copy of your site on my local server. What I want is - what steps I should follow to see the issue?

#2562729

Attempt to add a listing, or as an administrator (using the front end) try to edit a listing. I don't know how to be more clear about it. There is a big button on the main screen "add your listing" or it is also in the site menu bar. Similarly, when viewing a listing, if you are an admin, there is an "Edit" link in the upper right of the listing.

#2563581

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

The issue is with the form you are having issue with:
- versteckter Link
- versteckter Link

Both forms having conditional display added at top of the form but the conditional group's condition is malformed. Its not correct. You will have to set the correct condition for your conditional group.

Please check the following screenshot: versteckter Link

Please adjust the conditional group conditions correctly and save the form and it should be back to work without any issues.

#2563971

I will pass this on to the site designer. It is curious that it caused no problems in PHP7.4, do you have any insight as to why that would be the case?

#2563997

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

As you know its due to PHP version and PHP 8 should have strict parsing method.

You should adjust the conditional display for your conditional group and it should be fine.

#2565689

The person who set it up says: I am trying to get my head back into the logic of this site. Obviously, the hidden conditional group should only affect itself. The rest of the form should be visible. I do not think it should throw an error regardless.

Can you further clarify what is invalid in the conditional and how it might be fixed??

#2566649

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

As shared with my previous reply where I shared the screenshot of the conditional group:
- versteckter Link

The conditional group shows just (false) you can adjust the conditional to your requirement or just remove the conditional group as I'm not sure what condition you have added there before.