soflyy / oxygen-bugs-and-features

Bug Reports & Feature Requests for Oxygen
https://oxygenbuilder.com/
315 stars 29 forks source link

Oxy 4.7.1 PHP Warning 'Undefined property: Oxygen_VSB_Dynamic_Shortcodes::$custom_dynamic_datas' #3455

Open maltmann-muc opened 10 months ago

maltmann-muc commented 10 months ago

Environment: PHP 8.1, WP 6.4.1, Oxy 4.7.1 Situation: In Builder

File and Function: wp-content/plugins/oxygen/component-framework/includes/oxygen-dynamic-shortcodes.php oxygen_custom()

Warning and Call Stack:

Warning:  Undefined property: Oxygen_VSB_Dynamic_Shortcodes::$custom_dynamic_datas in /.../wp-content/plugins/oxygen/component-framework/includes/oxygen-dynamic-shortcodes.php on line 455
Stack trace:
  1. {main}() /.../wp-admin/admin-ajax.php:0
  2. do_action($hook_name = 'wp_ajax_ct_get_template_data') /.../wp-admin/admin-ajax.php:188
  3. WP_Hook->do_action($args = [0 => '']) /.../wp-includes/plugin.php:517
  4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /.../wp-includes/class-wp-hook.php:348
  5. ct_get_template_data('') /.../wp-includes/class-wp-hook.php:324
  6. ct_get_templates_term($template_id = 2226, $term_id = FALSE, $option = FALSE, $catch_all = FALSE) /.../wp-content/plugins/oxygen/component-framework/includes/ajax.php:1493
  7. ct_filter_post_object($post_object = class WP_Post { public $ID = 2391; public $post_author = 'maltmann'; public $post_date = '2023-10-30 23:43:12'; public $post_date_gmt = '2023-10-30 22:43:12'; public $post_content = ''; public $post_title = 'Test nested Repeaters'; public $post_excerpt = ''; public $post_status = 'publish'; public $comment_status = 'open'; public $ping_status = 'open'; public $post_password = ''; public $post_name = 'test-nested-repeaters'; public $to_ping = ''; public $pinged = ''; public $post_modified = '2023-10-31 01:38:00'; public $post_modified_gmt = '2023-10-31 00:38:00'; public $post_content_filtered = ''; public $post_parent = 0; public $guid = 'https://oxygen.altmann.de/?p=2391'; public $menu_order = 0; public $post_type = 'post'; public $post_mime_type = ''; public $comment_count = '0'; public $filter = 'raw'; public $relevanssi_light_data = NULL; public $post_tree = [0 => [...], 1 => [...]] }, $no_custom_view = *uninitialized*, $preview_post_id = *uninitialized*) /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:1238
  8. do_oxygen_elements($node = ['id' => 0, 'name' => 'root', 'depth' => 0, 'children' => [0 => [...], 1 => [...]], 'meta_keys' => [0 => 'classic-editor-remember', 1 => 'related_posts', 2 => 'oxygen_lock_post_edit_mode', 3 => 'image_group_repeater_0_image_group_title', 4 => 'image_group_repeater_0_images_repeater_0_image', 5 => 'image_group_repeater_0_images_repeater_1_image', 6 => 'image_group_repeater_0_images_repeater', 7 => 'image_group_repeater_1_image_group_title', 8 => 'image_group_repeater_1_images_repeater_0_image', 9 => 'image_group_repeater_1_images_repeater', 10 => 'image_group_repeater', 11 => 'image_group_repeater_0_images_repeater_0_images_repeater_image', 12 => 'image_group_repeater_0_images_repeater_1_images_repeater_image', 13 => 'image_group_repeater_1_images_repeater_0_images_repeater_image'], 'outerTemplateData' => ['edit_link' => 'https://oxygen.altmann.de/wp-admin/post.php?post=1266&action=edit', 'template_name' => 'Main - Page (page width)']]) /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:1495
  9. Oxygen_VSB_Dynamic_List->add_shortcode($atts = ['ct_options' => '{"ct_id":2,"ct_parent":0,"selector":"_dynamic_list-2-2391","original":{"use_acf_repeater":"true","acf_repeater":"field_654031b338e16"},"nicename":"Repeater (#2)","activeselector":false}'], $content = [0 => ['id' => 3, 'name' => 'ct_div_block', 'options' => [...], 'depth' => 3, 'children' => [...]]], $name = 'oxy_dynamic_list') /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:76
 10. do_oxygen_elements($node = [0 => ['id' => 3, 'name' => 'ct_div_block', 'options' => [...], 'depth' => 3, 'children' => [...]]]) /.../wp-content/plugins/oxygen/component-framework/components/classes/dynamic-list.class.php:844
 11. CT_DIV_Block->add_shortcode($atts = ['ct_options' => '{"ct_id":3,"ct_parent":2,"selector":"div_block-3-2391","original":[],"nicename":"Div (#3)","activeselector":""}'], $content = [0 => ['id' => 8, 'name' => 'ct_headline', 'options' => [...], 'depth' => 4, 'children' => [...]], 1 => ['id' => 51, 'name' => 'ct_code_block', 'options' => [...], 'depth' => 4], 2 => ['id' => 19, 'name' => 'oxy_dynamic_list', 'options' => [...], 'depth' => 4, 'children' => [...]]], $name = 'ct_div_block') /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:76
 12. do_oxygen_elements($node = [0 => ['id' => 8, 'name' => 'ct_headline', 'options' => [...], 'depth' => 4, 'children' => [...]], 1 => ['id' => 51, 'name' => 'ct_code_block', 'options' => [...], 'depth' => 4], 2 => ['id' => 19, 'name' => 'oxy_dynamic_list', 'options' => [...], 'depth' => 4, 'children' => [...]]]) /.../wp-content/plugins/oxygen/component-framework/components/classes/div-block.class.php:48
 13. Oxygen_VSB_Dynamic_List->add_shortcode($atts = ['ct_options' => '{"ct_id":19,"ct_parent":3,"selector":"_dynamic_list-19-2391","original":{"use_acf_repeater":"true","acf_repeater":"field_65403433854e4"},"nicename":"Repeater (#19)","activeselector":false}'], $content = [0 => ['id' => 20, 'name' => 'ct_div_block', 'options' => [...], 'depth' => 5, 'children' => [...]]], $name = 'oxy_dynamic_list') /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:76
 14. do_oxygen_elements($node = [0 => ['id' => 20, 'name' => 'ct_div_block', 'options' => [...], 'depth' => 5, 'children' => [...]]]) /.../wp-content/plugins/oxygen/component-framework/components/classes/dynamic-list.class.php:844
 15. CT_DIV_Block->add_shortcode($atts = ['ct_options' => '{"ct_id":20,"ct_parent":19,"selector":"div_block-20-2391","original":[],"nicename":"Div (#20)"}'], $content = [0 => ['id' => 32, 'name' => 'ct_image', 'options' => [...], 'depth' => 6], 1 => ['id' => 40, 'name' => 'ct_text_block', 'options' => [...], 'depth' => 6], 2 => ['id' => 78, 'name' => 'ct_code_block', 'options' => [...], 'depth' => 6], 3 => ['id' => 140, 'name' => 'ct_text_block', 'options' => [...], 'depth' => 6, 'children' => [...]]], $name = 'ct_div_block') /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:76
 16. do_oxygen_elements($node = [0 => ['id' => 32, 'name' => 'ct_image', 'options' => [...], 'depth' => 6], 1 => ['id' => 40, 'name' => 'ct_text_block', 'options' => [...], 'depth' => 6], 2 => ['id' => 78, 'name' => 'ct_code_block', 'options' => [...], 'depth' => 6], 3 => ['id' => 140, 'name' => 'ct_text_block', 'options' => [...], 'depth' => 6, 'children' => [...]]]) /.../wp-content/plugins/oxygen/component-framework/components/classes/div-block.class.php:48
 17. CT_Image->add_shortcode($atts = ['ct_options' => '{"ct_id":32,"ct_parent":20,"selector":"image-32-2391","original":{"image_type":"2","attachment_size":"full","attachment_id":"[oxygen ct_sign_sha256=\'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef\' data=\'custom_acf_image_id\' settings_path=\'image\' settings_page=\'false\' ]"},"nicename":"Image (#32)","activeselector":false}'], $content = '', $name = 'ct_image') /.../wp-content/plugins/oxygen/component-framework/includes/templates.php:76
 18. do_shortcode($content = '[oxygen ct_sign_sha256=\'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef\' data=\'custom_acf_image_id\' settings_path=\'image\' settings_page=\'false\' ]', $ignore_html = *uninitialized*) /.../wp-content/plugins/oxygen/component-framework/components/classes/image.class.php:62
 19. preg_replace_callback($pattern = '/\\[(\\[?)(oxygen)(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*+(?:\\[(?!\\/\\2\\])[^\\[]*+)*+)\\[\\/\\2\\])?)(\\]?)/', $callback = 'do_shortcode_tag', $subject = '[oxygen ct_sign_sha256=\'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef\' data=\'custom_acf_image_id\' settings_path=\'image\' settings_page=\'false\' ]') /.../wp-includes/shortcodes.php:273
 20. do_shortcode_tag($m = [0 => '[oxygen ct_sign_sha256=\'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef\' data=\'custom_acf_image_id\' settings_path=\'image\' settings_page=\'false\' ]', 1 => '', 2 => 'oxygen', 3 => ' ct_sign_sha256=\'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef\' data=\'custom_acf_image_id\' settings_path=\'image\' settings_page=\'false\' ', 4 => '', 5 => '', 6 => '']) /.../wp-includes/shortcodes.php:273
 21. Oxygen_VSB_Dynamic_Shortcodes->oxygen_vsb_dynamic_shortcode($atts = ['ct_sign_sha256' => 'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef', 'data' => 'custom_acf_image_id', 'settings_path' => 'image', 'settings_page' => 'false'], $content = '', 'oxygen') /.../wp-includes/shortcodes.php:433
 22. Oxygen_VSB_Dynamic_Shortcodes->oxygen_custom($atts = ['ct_sign_sha256' => 'b8291db7f7944d4c32ab2286334cb4cb459266471295e0c0e396fb30317900ef', 'data' => 'custom_acf_image_id', 'settings_path' => 'image', 'settings_page' => 'false']) /.../wp-content/plugins/oxygen/component-framework/includes/oxygen-dynamic-shortcodes.php:70

Description: $this doesn't have a property "custom_dynamic_datas" when trying to parse shortcode custom_acf_image_id. Interestingly, I don't even have an ACF Image in this template. Didn't investigate where it comes from.

Bildschirmfoto 2023-11-23 um 09 14 48

Solution: Change foreach ( $this->custom_dynamic_datas as $custom_dynamic_data ) { To foreach ( ($this->custom_dynamic_datas??[]) as $custom_dynamic_data ) {

maltmann-muc commented 10 months ago

Oxy 4.8 RC 1: Issue persists.