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.6k stars 1.42k forks source link

Function utf8_decode() is deprecated #27499

Open jamieburchell opened 6 months ago

jamieburchell commented 6 months ago

Prerequisites

Description

As per https://github.com/elementor/elementor/issues/27308

Elementor does not use this function. This is not coming from Elementor

It's right here, in the very first line of the backtrace:

plugins/elementor-pro/modules/screenshots/module.php on line 33

$response = wp_remote_get( utf8_decode( $url ) );

Please, troubleshoot your issue before submitting it here,

I have. Please extend me the same courtesy by carefully reading the bug report I have taken the time to submit.

and make sure to provide the full ELEMENTOR SYSTEM INFO.

Apologies, it seems I accidentally provided the WP built-in status info instead, which I will rectify below. Perhaps a better use of everyone's time could have been allowing me to edit my original issue to provide this.

Backtrace:

[26-May-2024 14:41:38 UTC] PHP Deprecated:  Function utf8_decode() is deprecated in ../app/plugins/elementor-pro/modules/screenshots/module.php on line 33
[26-May-2024 14:41:38 UTC] PHP Stack trace:
[26-May-2024 14:41:38 UTC] PHP   1. {main}() ../index.php:0
[26-May-2024 14:41:38 UTC] PHP   2. require() ../index.php:6
[26-May-2024 14:41:38 UTC] PHP   3. require_once() ../wp/wp-blog-header.php:13
[26-May-2024 14:41:38 UTC] PHP   4. require_once() ../wp/wp-load.php:55
[26-May-2024 14:41:38 UTC] PHP   5. require_once() ../wp-config.php:10
[26-May-2024 14:41:38 UTC] PHP   6. do_action($hook_name = 'init') ../wp/wp-settings.php:695
[26-May-2024 14:41:38 UTC] PHP   7. WP_Hook->do_action($args = [0 => '']) ../wp/wp-includes/plugin.php:517
[26-May-2024 14:41:38 UTC] PHP   8. WP_Hook->apply_filters($value = '', $args = [0 => '']) ../wp/wp-includes/class-wp-hook.php:348
[26-May-2024 14:41:38 UTC] PHP   9. Elementor\Plugin->init('') ../wp/wp-includes/class-wp-hook.php:324
[26-May-2024 14:41:38 UTC] PHP  10. do_action($hook_name = 'elementor/init') ../app/plugins/elementor/includes/plugin.php:658
[26-May-2024 14:41:38 UTC] PHP  11. WP_Hook->do_action($args = [0 => '']) ../wp/wp-includes/plugin.php:517
[26-May-2024 14:41:38 UTC] PHP  12. WP_Hook->apply_filters($value = '', $args = [0 => '']) ../wp/wp-includes/class-wp-hook.php:348
[26-May-2024 14:41:38 UTC] PHP  13. ElementorPro\Plugin->on_elementor_init('') ../wp/wp-includes/class-wp-hook.php:324
[26-May-2024 14:41:38 UTC] PHP  14. ElementorPro\Core\Modules_Manager->__construct() ../app/plugins/elementor-pro/plugin.php:361
[26-May-2024 14:41:38 UTC] PHP  15. Elementor\Core\Base\Module::instance() ../app/plugins/elementor-pro/core/modules-manager.php:93
[26-May-2024 14:41:38 UTC] PHP  16. ElementorPro\Modules\Screenshots\Module->__construct() ../app/plugins/elementor/core/base/module.php:85
[26-May-2024 14:41:38 UTC] PHP  17. ElementorPro\Modules\Screenshots\Module->get_proxy_data($url = 'https://fonts.googleapis.com/css?family=Open Sans:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic') ../app/plugins/elementor-pro/modules/screenshots/module.php:265
[26-May-2024 14:41:38 UTC] PHP Warning:  Cannot modify header information - headers already sent by (output started at ../app/plugins/elementor-pro/modules/screenshots/module.php:33) in ../app/plugins/elementor-pro/modules/screenshots/module.php on line 41
[26-May-2024 14:41:38 UTC] PHP Stack trace:
[26-May-2024 14:41:38 UTC] PHP   1. {main}() ../index.php:0
[26-May-2024 14:41:38 UTC] PHP   2. require() ../index.php:6
[26-May-2024 14:41:38 UTC] PHP   3. require_once() ../wp/wp-blog-header.php:13
[26-May-2024 14:41:38 UTC] PHP   4. require_once() ../wp/wp-load.php:55
[26-May-2024 14:41:38 UTC] PHP   5. require_once() ../wp-config.php:10
[26-May-2024 14:41:38 UTC] PHP   6. do_action($hook_name = 'init') ../wp/wp-settings.php:695
[26-May-2024 14:41:38 UTC] PHP   7. WP_Hook->do_action($args = [0 => '']) ../wp/wp-includes/plugin.php:517
[26-May-2024 14:41:38 UTC] PHP   8. WP_Hook->apply_filters($value = '', $args = [0 => '']) ../wp/wp-includes/class-wp-hook.php:348
[26-May-2024 14:41:38 UTC] PHP   9. Elementor\Plugin->init('') ../wp/wp-includes/class-wp-hook.php:324
[26-May-2024 14:41:38 UTC] PHP  10. do_action($hook_name = 'elementor/init') ../app/plugins/elementor/includes/plugin.php:658
[26-May-2024 14:41:38 UTC] PHP  11. WP_Hook->do_action($args = [0 => '']) ../wp/wp-includes/plugin.php:517
[26-May-2024 14:41:38 UTC] PHP  12. WP_Hook->apply_filters($value = '', $args = [0 => '']) ../wp/wp-includes/class-wp-hook.php:348
[26-May-2024 14:41:38 UTC] PHP  13. ElementorPro\Plugin->on_elementor_init('') ../wp/wp-includes/class-wp-hook.php:324
[26-May-2024 14:41:38 UTC] PHP  14. ElementorPro\Core\Modules_Manager->__construct() ../app/plugins/elementor-pro/plugin.php:361
[26-May-2024 14:41:38 UTC] PHP  15. Elementor\Core\Base\Module::instance() ../app/plugins/elementor-pro/core/modules-manager.php:93
[26-May-2024 14:41:38 UTC] PHP  16. ElementorPro\Modules\Screenshots\Module->__construct() ../app/plugins/elementor/core/base/module.php:85
[26-May-2024 14:41:38 UTC] PHP  17. ElementorPro\Modules\Screenshots\Module->get_proxy_data($url = 'https://fonts.googleapis.com/css?family=Open Sans:100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic') ../app/plugins/elementor-pro/modules/screenshots/module.php:265
[26-May-2024 14:41:38 UTC] PHP  18. header($header = 'content-type: text/css; charset=utf-8') ../app/plugins/elementor-pro/modules/screenshots/module.php:41

Steps to reproduce

  1. PHP 8.2 with deprecation notices enabled
  2. Only Elementor & Elementor Pro installed
  3. Create a new template, the page must reference external CSS/JS to enable the "screenshot proxy mode"
  4. Open the Theme Builder / trigger template screenshot generation
  5. Note "PHP Deprecated: Function utf8_decode() is deprecated" in debug log

Expected behavior

Don't use the deprecated function

Isolating the problem

Elementor System Info

Click to reveal ````txt == Server Environment == Operating System: Linux Software: Apache/2.4.52 (Ubuntu) MySQL version: Ubuntu 22.04 v10.6.16 PHP Version: 8.2.19 PHP Memory Limit: 256M PHP Max Input Vars: 10000 PHP Max Post Size: 64M GD Installed: Yes ZIP Installed: Yes Write Permissions: All right Elementor Library: Connected == WordPress Environment == Version: 6.5.3 Site URL: https://example.com/wp Home URL: https://example.com WP Multisite: No Max Upload Size: 16 MB Memory limit: 40M Max Memory limit: 256M Permalink Structure: /%category%/%year%/%monthnum%/%day%/%postname%/ Language: en_GB Timezone: Europe/London Debug Mode: Active == Theme == Name: Hello Elementor Version: 3.0.1 Author: Elementor Team Child Theme: No == User == Role: administrator WP Profile lang: en-GB User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 == Active Plugins == Elementor Version: 3.21.8 Author: Elementor.com Elementor Pro Version: 3.21.3 Author: Elementor.com == Must-Use Plugins == Bedrock Autoloader Version: 1.0.3 Author: Roots Disable status tests Version: 1.0.0 Author: Roots Register Theme Directory Version: 1.0.0 Author: Roots == Features == Custom Fonts: 0 Custom Icons: 0 == Integrations == == Elementor Experiments == Improved Asset Loading: Active by default Improved CSS Loading: Active Inline Font Icons: Inactive Additional Custom Breakpoints: Inactive admin_menu_rearrangement: Inactive by default Flexbox Container: Active Upgrade Swiper Library: Active Grid Container: Inactive Nested Elements Performance: Inactive by default Optimized Control Loading: Inactive Default to New Theme Builder: Active Hello Theme Header & Footer: Inactive Elementor Home Screen: Active by default Editor Top Bar: Inactive Build with AI: Inactive Landing Pages: Inactive Nested Elements: Inactive Lazy Load Background Images: Inactive Display Conditions: Inactive Form Submissions: Active Menu: Inactive Taxonomy Filter: Inactive == Log == Log: showing 20 of 402024-04-30 11:45:51 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.21.0', 'to' => '3.21.1', )] 2024-05-07 10:26:52 [info] Update DB has been started [array ( 'plugin' => 'Elementor', 'from' => '3.21.3', 'to' => '3.21.4', )] 2024-05-07 10:26:52 [info] elementor::elementor_updater Started 2024-05-07 10:26:52 [info] Elementor/Upgrades - _on_each_version Start 2024-05-07 10:26:52 [info] Elementor/Upgrades - _on_each_version Finished 2024-05-07 10:26:52 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.21.3', 'to' => '3.21.4', )] 2024-05-07 10:26:55 [info] Update DB has been started [array ( 'plugin' => 'Elementor Pro', 'from' => '3.21.1', 'to' => '3.21.2', )] 2024-05-07 10:26:55 [info] elementor-pro::elementor_pro_updater Started 2024-05-07 10:26:55 [info] Elementor Pro/Upgrades - _on_each_version Start 2024-05-07 10:26:55 [info] Elementor Pro/Upgrades - _on_each_version Finished 2024-05-07 10:26:55 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor Pro', 'from' => '3.21.1', 'to' => '3.21.2', )] 2024-05-13 09:24:28 [info] Update DB has been started [array ( 'plugin' => 'Elementor', 'from' => '3.21.4', 'to' => '3.21.5', )] 2024-05-13 09:24:28 [info] elementor::elementor_updater Started 2024-05-13 09:24:28 [info] Elementor/Upgrades - _on_each_version Start 2024-05-13 09:24:28 [info] Elementor/Upgrades - _on_each_version Finished 2024-05-13 09:24:28 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.21.4', 'to' => '3.21.5', )] 2024-05-26 15:33:43 [info] elementor::elementor_updater Started 2024-05-26 15:33:43 [info] Elementor/Upgrades - _on_each_version Start 2024-05-26 15:33:43 [info] Elementor/Upgrades - _on_each_version Finished 2024-05-26 15:33:43 [info] Elementor data updater process has been completed. [array ( 'plugin' => 'Elementor', 'from' => '3.21.5', 'to' => '3.21.8', )] PHP: showing 3 of 3PHP: 2024-05-15 07:22:43 [warning X 2][../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php::150] Undefined array key "condition_type" [array ( 'trace' => ' #0: ../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php(150): Elementor\Core\Logger\Manager -> rest_error_handler() #1: ElementorPro\Core\App\Modules\SiteEditor\Data\Endpoints\Templates -> normalize_template_json_item() #2: ../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php(120): class type array_map() #3: ../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php(59): ElementorPro\Core\App\Modules\SiteEditor\Data\Endpoints\Templates -> normalize_templates_json() #4: ../plugins/elementor/data/base/endpoint.php(158): ElementorPro\Core\App\Modules\SiteEditor\Data\Endpoints\Templates -> get_items() ', )] PHP: 2024-05-26 15:35:03 [warning X 8][../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php::150] Undefined array key "condition_type" [array ( 'trace' => ' #0: ../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php(150): Elementor\Core\Logger\Manager -> rest_error_handler() #1: ElementorPro\Core\App\Modules\SiteEditor\Data\Endpoints\Templates -> normalize_template_json_item() #2: ../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php(120): class type array_map() #3: ../plugins/elementor-pro/core/app/modules/site-editor/data/endpoints/templates.php(59): ElementorPro\Core\App\Modules\SiteEditor\Data\Endpoints\Templates -> normalize_templates_json() #4: ../plugins/elementor/data/base/endpoint.php(158): ElementorPro\Core\App\Modules\SiteEditor\Data\Endpoints\Templates -> get_items() ', )] PHP: 2024-05-26 15:41:39 [warning X 1][../plugins/elementor-pro/modules/screenshots/module.php::41] Cannot modify header information - headers already sent by (output started at ../plugins/elementor-pro/modules/screenshots/module.php:33) [array ( 'trace' => ' #0: Elementor\Core\Logger\Manager -> shutdown() ', )] == Elementor - Compatibility Tag == Elementor Pro: Compatible == Elementor Pro - Compatibility Tag == ````

Agreement

jamieburchell commented 2 weeks ago

@nicholaszein this happens when the "screenshot proxy mode" is used, which appears to be when assets from external websites (CSS, JS) are used on the page that a screenshot is being generated for. I have updated my repro steps.