PHP-Error in complex situation
-
Hi,
we have a case in the German-language forum where someone is encountering a fatal PHP error related to your plugin in a rather complex situation. However, I can reproduce it perfectly on a test system. Here’s how:
- Install and activate the plugin (no further configuration required)
- Install and activate Elementor (the free version, no further configuration required)
- Install and activate the Astra theme (presumably optional, but it works well)
- Install and activate Sugar Calendar Lite
- Go to Events and create a simple event scheduled for the future
- Go to Settings > Permalinks and save them again (because Sugar Calendar apparently doesn’t do this automatically)
- Go to Events > Calendar and access the only calendar listed there on the frontend => you’ll see an incomplete page, as this is when the error occurs.
The error:
PHP Fatal error: Uncaught Error: Call to a member function is_built_with_elementor() on bool in /var/www/clients/client1/web1/web/wp-content/plugins/embed-privacy/inc/integration/class-elementor.php:134
Stack trace:
#0 /var/www/clients/client1/web1/web/wp-content/plugins/embed-privacy/inc/integration/class-elementor.php(163): epiphyt\Embed_Privacy\integration\Elementor::is_used()
#1 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(341): epiphyt\Embed_Privacy\integration\Elementor::replace_youtube()
#2 /var/www/clients/client1/web1/web/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#3 /var/www/clients/client1/web1/web/wp-content/plugins/embed-privacy/inc/embed/class-replacement.php(66): apply_filters()
#4 /var/www/clients/client1/web1/web/wp-content/plugins/embed-privacy/inc/data/class-replacer.php(129): epiphyt\Embed_Privacy\embed\Replacement->get()
#5 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(343): epiphyt\Embed_Privacy\data\Replacer::replace_embeds()
#6 /var/www/clients/client1/web1/web/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#7 /var/www/clients/client1/web1/web/wp-includes/class-wp-block.php(651): apply_filters()
#8 /var/www/clients/client1/web1/web/wp-includes/blocks.php(2383): WP_Block->render()
#9 /var/www/clients/client1/web1/web/wp-includes/blocks.php(2466): render_block()
#10 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(341): do_blocks()
#11 /var/www/clients/client1/web1/web/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#12 /var/www/clients/client1/web1/web/wp-includes/post-template.php(256): apply_filters()
#13 /var/www/clients/client1/web1/web/wp-content/themes/astra/template-parts/single/content-header.php(37): the_content()
#14 /var/www/clients/client1/web1/web/wp-includes/template.php(816): require('...')
#15 /var/www/clients/client1/web1/web/wp-includes/template.php(749): load_template()
#16 /var/www/clients/client1/web1/web/wp-includes/general-template.php(206): locate_template()
#17 /var/www/clients/client1/web1/web/wp-content/themes/astra/inc/template-parts.php(370): get_template_part()
#18 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(341): astra_entry_content_single_page_template()
#19 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#20 /var/www/clients/client1/web1/web/wp-includes/plugin.php(522): WP_Hook->do_action()
#21 /var/www/clients/client1/web1/web/wp-content/themes/astra/inc/core/theme-hooks.php(450): do_action()
#22 /var/www/clients/client1/web1/web/wp-content/themes/astra/template-parts/content-page.php(28): astra_entry_content_single_page()
#23 /var/www/clients/client1/web1/web/wp-includes/template.php(816): require('...')
#24 /var/www/clients/client1/web1/web/wp-includes/template.php(749): load_template()
#25 /var/www/clients/client1/web1/web/wp-includes/general-template.php(206): locate_template()
#26 /var/www/clients/client1/web1/web/wp-content/themes/astra/inc/class-astra-loop.php(109): get_template_part()
#27 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(341): Astra_Loop->template_parts_page()
#28 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#29 /var/www/clients/client1/web1/web/wp-includes/plugin.php(522): WP_Hook->do_action()
#30 /var/www/clients/client1/web1/web/wp-content/themes/astra/inc/class-astra-loop.php(197): do_action()
#31 /var/www/clients/client1/web1/web/wp-content/themes/astra/inc/class-astra-loop.php(174): Astra_Loop->loop_markup()
#32 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(341): Astra_Loop->loop_markup_page()
#33 /var/www/clients/client1/web1/web/wp-includes/class-wp-hook.php(365): WP_Hook->apply_filters()
#34 /var/www/clients/client1/web1/web/wp-includes/plugin.php(522): WP_Hook->do_action()
#35 /var/www/clients/client1/web1/web/wp-content/themes/astra/inc/core/theme-hooks.php(265): do_action()
#36 /var/www/clients/client1/web1/web/wp-content/themes/astra/page.php(32): astra_content_page_loop()
#37 /var/www/clients/client1/web1/web/wp-includes/template-loader.php(125): include('...')
#38 /var/www/clients/client1/web1/web/wp-blog-header.php(19): require_once('...')
#39 /var/www/clients/client1/web1/web/index.php(17): require('...')
#40 {main}
thrown in /var/www/clients/client1/web1/web/wp-content/plugins/embed-privacy/inc/integration/class-elementor.php on line 134What’s happening here:
- Sugar Calendar Lite uses a “Virtual Event ID” with the fixed value 7575000 in Loader.php.
- Embed Privacy takes this value in the
is_used()function in class-elementor.php and passes it to Elementor. - Elementor doesn’t return an object for this pseudo-ID when using
Plugin::$instance->documents->get( \get_the_ID() )=> Error
Recommendation:
You should check if the passed ID is a real one and/or if Elementor returns an object before callingis_built_with_elementor().Unfortunately, I’m not aware of any other solutions, which is why the user in the forum is a bit stuck here 🙁
Feel free to contact me if you have any questions 🙂
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.