WPML

Overview of the Issue

If you have a form with checkboxes created with WPForms plugin running under a PHP 8x server, it won’t work when you try to submit it. Instead you will have this fatal error:

[14-Feb-2023 18:43:45 UTC] PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #1 ($key) must be a valid array offset type in …/wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Obj.php:98Stack trace: #5 …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Strings.php(191): WPML\FP\Obj::__callStatic('propOr’, Array)#6 [internal function]: WPML\Forms\Hooks\WpForms\Strings->WPML\Forms\Hooks\WpForms\{closure}(Array, 44)#17 …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Strings.php(197): WPML\FP\Obj::__callStatic('over’, Array)#18 …/wp-includes/class-wp-hook.php(308): WPML\Forms\Hooks\WpForms\Strings->translateEntry(Array, Array)

Workaround

This issue is fixed. Updating to the latest version solves it on your site, so you only need this workaround if you can’t update yet.

Please, be sure to make a full backup before proceeding.

  1. Open the …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Strings.php file.
  2. Look for line 185.
  3. Replace:
    if ( in_array( Obj::path( [ 'fields', $fieldId, 'type' ], $originalForm ), [ 'checkbox', 'radio', 'select' ], true ) ) {

    With:

    if ( in_array( Obj::path( [ 'fields', $fieldId, 'type' ], $originalForm ), [ 'radio', 'select' ], true ) ) {

All known issues

Still Seeing This Issue?

If updating doesn’t fix it, ask a support question and we’ll look into it with you.