If this solution does not resolve your issue or seems irrelevant due to updates or differences in your setup, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am trying to use WPML with Elementor on PHP 8.2. After switching the PHP version from 7.4 to 8.2 (and also 8.4), the homepage throws a fatal error related to WPML Page Builders integration.
Symptoms:
A fatal error occurs: 'Uncaught TypeError: Cannot access offset of type string on string in /wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DisplayConditions.php on line 138'. The stack trace includes functions like convertConditionIds(), convertCondition(), processDisplayConditions(), convertDisplayConditions(), Elementor → get_content(), ElementorPro Theme Builder → print_content(), and header.php → homepage crash.
Questions:
Why does the homepage throw a fatal error when using WPML with Elementor on PHP 8.2?
How can I resolve the fatal error related to WPML Page Builders integration?
There is currently no news regarding the issue. The matter is still in our second-tier queue. I will update you as soon as I receive any feedback from them.
I am writing to inform you that one of our second-tier support representatives is currently investigating the issue. While the duration of the debugging process is uncertain, I will provide updates as soon as I receive any feedback from the representative.
The issue is now escalated to our developers team, in the meantime, as a workaround, please follow the below steps:
- edit the file sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/Hooks/DisplayConditions.php, locate the function convertConditionIds (from line 134 in current versions), and replace the function with this code:
private function convertConditionIds( array $conditionGroups ) {
// ensure $conditionGroups is an array of arrays and not just an associative array
$result = array_keys($conditionGroups)[0] !== 0 ? array($conditionGroups) : $conditionGroups;
foreach ( $result as $key => $conditionGroup ) {
$configForCondition = $this->getConfigForCondition( $conditionGroup['condition'] );
if ( $configForCondition && isset( $conditionGroup[ $configForCondition['field'] ] ) ) {
$result[ $key ] = $this->convertIdsForCondition( $conditionGroup, $configForCondition );
}
}
return $result;
}