You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rest of the PHP warning: PHP Warning: Undefined array key "cpel_lv_languages" in /plugins/connect-polylang-elementor/includes/language-visibility.php on line 134
This kicks out in the php log with custom Elementor widgets when saving a post in the elementor editor
Looks like my PHP 8.2 doesn't like that $languages doesn't have a fallback value like an empty array when instantiated, when $settings['cpel_lv_languages'] is null/empty.
Currently $languages = (array) $settings['cpel_lv_languages'];
Solution:
Both of these lines below worked for me to solve the issue by replacing line #134:
Option 1)
Matches best with current plugin PHP code principles: $languages = isset( $settings['cpel_lv_languages'] ) ? $settings['cpel_lv_languages'] : array();
Issue:
Rest of the PHP warning:
PHP Warning: Undefined array key "cpel_lv_languages" in /plugins/connect-polylang-elementor/includes/language-visibility.php on line 134
This kicks out in the php log with custom Elementor widgets when saving a post in the elementor editor
Looks like my PHP 8.2 doesn't like that
$languages
doesn't have a fallback value like an empty array when instantiated, when $settings['cpel_lv_languages'] is null/empty.Currently
$languages = (array) $settings['cpel_lv_languages'];
Solution:
Both of these lines below worked for me to solve the issue by replacing line #134:
Option 1)
Matches best with current plugin PHP code principles:
$languages = isset( $settings['cpel_lv_languages'] ) ? $settings['cpel_lv_languages'] : array();
Option 2)
PHP 7+ compatible null coalescing operator and array shorthand:
$languages = isset( $settings['cpel_lv_languages'] ) ?? [];
Plugin Versions:
Connect Polylang for Elementor: 2.4.3
Elementor 3.20.0
Elementor Pro 3.18.2
Polylang Pro 3.5.2
The text was updated successfully, but these errors were encountered: