Oxy 4.7.1/4.8/4.9 PHP Warning 'Undefined array key "icon-color/icon-background-color /icon-padding/icon-size"' when saving template/post in Builder
Opened this issue · 5 comments
Environment: PHP 8.1, WP 6.4.1, Oxy 4.7.1
Situation: In Builder when saving template/post containing e.g. an icon with a class assigned having a state like :hover
File and Function:
wp-content/plugins/oxygen/component-framework/component-init.php
ct_generate_class_states_css()
Warning and Call Stack:
Warning: Undefined array key "icon-color" in /.../wp-content/plugins/oxygen/component-framework/component-init.php on line 3023
Warning: Undefined array key "icon-background-color" in /.../wp-content/plugins/oxygen/component-framework/component-init.php on line 3024
Warning: Undefined array key "icon-padding" in /.../wp-content/plugins/oxygen/component-framework/component-init.php on line 3025
Warning: Undefined array key "icon-size" in /.../wp-content/plugins/oxygen/component-framework/component-init.php on line 3026
Stack trace:
1. {main}() /.../index.php:0
2. require() /.../index.php:17
3. require_once() /.../wp-blog-header.php:19
4. do_action($hook_name = 'template_redirect') /.../wp-includes/template-loader.php:13
5. WP_Hook->do_action($args = [0 => '']) /.../wp-includes/plugin.php:517
6. WP_Hook->apply_filters($value = '', $args = [0 => '']) /.../wp-includes/class-wp-hook.php:348
7. ct_save_components_tree_as_post('') /.../wp-includes/class-wp-hook.php:324
8. oxygen_vsb_cache_universal_css() /.../wp-content/plugins/oxygen/component-framework/includes/ajax.php:273
9. oxygen_vsb_get_classes_styles() /.../wp-content/plugins/oxygen/component-framework/includes/cache.php:19
10. ct_generate_class_states_css($class = 'aaa-video-control', $state = 'hover', $options = ['icon-color' => '#ffffff'], $is_media = *uninitialized*, $is_selector = *uninitialized*) /.../wp-content/plugins/oxygen/component-framework/component-init.php:2872
Description:
$options may or may not contain fields "icon-background-color", "icon-padding", "icon-size".
Solution:
Change
$iconColor = oxygen_vsb_get_global_color_value($options['icon-color']);
$iconBackgroundColor= oxygen_vsb_get_global_color_value($options['icon-background-color']);
$iconPadding = $options['icon-padding'];
$iconSize = $options['icon-size'];
To
$iconColor = oxygen_vsb_get_global_color_value($options['icon-color']??null);
$iconBackgroundColor= oxygen_vsb_get_global_color_value($options['icon-background-color']??null);
$iconPadding = $options['icon-padding']??null;
$iconSize = $options['icon-size']??null;
Oxy 4.8 RC 1: Issue persists.
Oxy 4.8: Issue persists.
Confirmed and reported internally via https://github.com/soflyy/oxygen/issues/5055
Seeing this same issue on the latest prod build with 6.5.2
Oxy 4.9: Issue persists.