- Status
- Resolved
- Reported for
- WPForms Multilingual 0.3.0
- Resolved in
- 0.3.1
- Related plugin/theme
- WP Forms
- Topic tags
- Compatibility
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
Please, be sure to make a full backup before proceeding.
- Open the …/wp-content/plugins/wpml-wpforms/classes/Hooks/WpForms/Strings.php file.
- Look for line 185.
- 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 ) ) {