elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.
https://elementor.com/
GNU General Public License v3.0
6.61k stars 1.42k forks source link

βœ… 🐞 Bug Report: Numerous "Cannot get a not-exists control." on a single page load - [ED-8590] #20027

Closed jpSimkins closed 1 year ago

jpSimkins commented 2 years ago

Prerequisites

Description

The front page of a vanilla site with just Elementor installed and using the Hello theme causes over 150 WP_Errors

Cannot get a not-exists control.

If this is intended behavior, consider not using WP_Error as this has overhead that will affect performance on larger sites.

Steps to reproduce

1) Install a fresh WP 2) Activate Elementor 3) Load home page and examine the hooks

To make this easier to see, add

    echo '<hr/>';
    echo nl2br($hook_name . PHP_EOL);
    echo '<pre>' . print_r($arg, true) . '</pre>';

To the do_action method in wp-includes/plugin.php:439

Isolating the problem

System Info

System Info ````txt == Server Environment == Operating System: Linux Software: Apache MySQL version: MySQL Community Server (GPL) v5.7.38 PHP Version: 7.4.29 PHP Memory Limit: 128M PHP Max Input Vars: 1000 PHP Max Post Size: 64M GD Installed: Yes ZIP Installed: Yes Write Permissions: All right Elementor Library: Connected == WordPress Environment == Version: 6.0.2 Site URL: https://test.local/wordpress Home URL: https://test.local WP Multisite: No Max Upload Size: 64 MB Memory limit: 40M Max Memory limit: 256M Permalink Structure: Plain Language: en-US Timezone: 0 Admin Email: private Debug Mode: Active == Theme == Name: Hello Elementor Version: 2.6.1 Author: Elementor Team Child Theme: No == User == Role: administrator WP Profile lang: en_US User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 == Active Plugins == Elementor Version: 3.7.8 Author: Elementor.com == Must-Use Plugins == Olympusat WordPress Core Version: 1.3.0 == Elementor Experiments == Optimized DOM Output: Active by default Improved Asset Loading: Active by default Improved CSS Loading: Active by default Inline Font Icons: Inactive by default Accessibility Improvements: Active by default Additional Custom Breakpoints: Active by default Import Export Template Kit: Active by default Hide native WordPress widgets from search results: Active by default admin_menu_rearrangement: Inactive by default Flexbox Container: Inactive by default Hello Theme Header & Footer: Active by default Landing Pages: Active by default Color Sampler: Active by default Favorite Widgets: Active by default Admin Top Bar: Active by default == Log == == Elementor - Compatibility Tag == ````
nicholaszein commented 2 years ago

Hello @jpSimkins!

Thank you for submitting your issue! πŸ™

Please allow us some time to investigate it, and get back to you with our findings. 🧐

Best regards

rami-elementor commented 2 years ago

To make this easier to see, add

    echo '<hr/>';
    echo nl2br($hook_name . PHP_EOL);
    echo '<pre>' . print_r($arg, true) . '</pre>';

To the do_action method in wp-includes/plugin.php:439

  1. You should not edit core WP files.
  2. Did you tested this without Elementor?
  3. Seems like Elementor is not your only active plugins. You have "Olympusat WordPress Core" Must-Use Plugins. Please deactivate that one too share the results.
jpSimkins commented 2 years ago
  1. You should not edit core WP files.
  2. Did you tested this without Elementor?
  3. Seems like Elementor is not your only active plugins. You have "Olympusat WordPress Core" Must-Use Plugins. Please deactivate that one too share the results.
  1. This rule is only warranted for fixes to code, not identifying issues. Not saying this is a fix... I am showing you how to see the issue.
  2. This is literally and Elementor error. (managers/controls.php: 877). This can only happen with Elementor.
  3. I have an MU plugin that has nothing but Constructs. There are no hooks or any other files loading. That mu-plugin is not doing anything but providing classes for me to use. That plugin has no effect on this issue. For sake of argument, it still happens with this:
== Server Environment ==
Operating System: Linux
Software: Apache
MySQL version: MySQL Community Server (GPL) v5.7.38
PHP Version: 7.4.29
PHP Memory Limit: 128M
PHP Max Input Vars: 1000
PHP Max Post Size: 64M
GD Installed: Yes
ZIP Installed: Yes
Write Permissions: All right
Elementor Library: Connected

== WordPress Environment ==
Version: 6.0.2
Site URL: https://test.local/wordpress
Home URL: https://test.local/
WP Multisite: No
Max Upload Size: 64 MB
Memory limit: 40M
Max Memory limit: 256M
Permalink Structure: Plain
Language: en-US
Timezone: 0
Admin Email: private
Debug Mode: Active

== Theme ==
Name: Hello Elementor
Version: 2.6.1
Author: Elementor Team
Child Theme: No

== User ==
Role: administrator
WP Profile lang: en_US
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36

== Active Plugins ==
Elementor
Version: 3.7.8
Author: Elementor.com

== Elementor Experiments ==
Optimized DOM Output: Active by default
Improved Asset Loading: Active by default
Improved CSS Loading: Active by default
Inline Font Icons: Inactive by default
Accessibility Improvements: Active by default
Additional Custom Breakpoints: Active by default
Import Export Template Kit: Active by default
Hide native WordPress widgets from search results: Active by default
admin_menu_rearrangement: Inactive by default
Flexbox Container: Inactive by default
Hello Theme Header & Footer: Active by default
Landing Pages: Active by default
Color Sampler: Active by default
Favorite Widgets: Active by default
Admin Top Bar: Active by default

== Log ==

== Elementor - Compatibility Tag ==

I explained how to see it visually since you won't see any errors (edit the core file to see the side effects of how Elementor is using it). On the default theme with nothing on it, it has over 150 calls to this which invokes other hooks (wasting over 400 calls, which add up and add useless latency). This is an expensive cost for falsy checks, which is what I have seen this used for. If you use this on a site that has a lot of content, this is costing well over 100,000 calls and has noticeable performance impacts (> 3 seconds loading cost).

It would appear that this is intended by design, given that this is being used for falsy checks in the code. I am suggesting a better approach due to the cost WP_Error has due to it firing other hooks. If I used a plugin that hooks into the WP_Error system then this would cause a lot of false positives, which I have already experienced.

I just wanted to bring this to your attention. I do hope that you consider improving the code for this and wasn't sure if you were aware of the expense that WP_Error adds.

Thank you

nicholaszein commented 1 year ago

Hello there @jpSimkins!

We have great news! πŸ™Œ

πŸ“’ We're happy to announce that the issue you raised was resolved in Elementor v3.10! πŸ₯³

βœ”οΈ Please feel free to check it out and update your plugin to the new version!

Cheers πŸ₯‚