elementor / elementor/elementor
⏳ 🐘 PHP 8.4+ deprecation in Atomic_Global_Styles::get_cache_root_key() on Elementor 4.2.0
- Dominant language
- PHP
- Stars
- 7.1k
- Forks
- 1.6k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 193
Description
### Description
Elementor 4.2.0 produces a PHP deprecation notice because `Atomic_Global_Styles::get_cache_root_key()` declares a non-nullable `string` parameter with `null` as its default value.
Implicitly nullable parameter types were deprecated in PHP 8.4. The parameter must explicitly be declared nullable.
### Error
```text
Elementor\Modules\GlobalClasses\Atomic_Global_Styles::get_cache_root_key(): Implicitly marking parameter $key as nullable is deprecated, the explicit nullable type must be used instead
```
### Location
```text
wp-content/plugins/elementor/modules/global-classes/atomic-global-styles.php:410
```
### Additional evidence
The identical deprecation appears in the diagnostic information attached to issue #36591 under Elementor 4.2.0-beta2 and PHP 8.4.23. That issue concerns unrelated Atomic SVG/ACF defects, so this PHP compatibility problem requires a separate issue.
Related issue containing the same diagnostic notice: https://github.com/elementor/elementor/issues/36591
### Steps to reproduce
1. Install and activate Elementor 4.2.0.
2. Run WordPress using PHP 8.4 or PHP 8.5 with deprecation reporting enabled.
3. Load WordPress or execute a WP-CLI command that bootstraps WordPress:
```bash
wp eval 'echo "WordPress loaded.\n";'
```
4. Observe the deprecation notice during shutdown.
### Current declaration
```php
private function get_cache_root_key( string $key = null ): string {
```
### Expected declaration
```php
private function get_cache_root_key( ?string $key = null ): string {
```
### Expected behavior
Elementor should load on PHP 8.4 and PHP 8.5 without generating an implicit nullable parameter deprecation.
### Actual behavior
The deprecation is recorded by the Elementor logger whenever the affected class is loaded.
### Verified workaround
Changing the declaration to explicitly use `?string` removes the deprecation:
```php
private function get_cache_root_key( ?string $key = null ): string {
```
The modified file passes PHP syntax validation, and subsequent WP-CLI executions no longer produce the notice.
### Elementor System Info
Click to reveal
```txt
== Server Environment ==
Operating System: Linux
Software: nginx/1.31.3
MySQL version: MariaDB Server v12.3.2-MariaDB
PHP Version: 8.5.8
PHP Memory Limit: 512M
PHP Max Input Vars: 5000
PHP Max Post Size: 128M
GD Installed: Yes
ZIP Installed: Yes
Write Permissions: All right
Elementor Library: Connected
== WordPress Environment ==
Version: 7.0.2
Site URL: [redacted]
Home URL: [redacted]
WP Multisite: No
Max Upload Size: 128 MB
Memory limit: 40M
Max Memory limit: 512M
Permalink Structure: /%postname%/
Language: en_US
Timezone: 0
Debug Mode: Inactive
== Theme ==
Name: Hello Elementor
Version: 3.4.9
Author: Elementor Team
Child Theme: No
== User ==
Role: administrator
WP Profile lang: en-US
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36
== Active Plugins ==
bunny.net
Version: 3.1.0
Author: bunny.net
Disable Comments RB
Version: 1.0.27
Author: rbPlugins
Elementor
Version: 4.2.0
Author: Elementor.com
Elementor Pro
Version: 4.2.0
Author: Elementor.com
Hello Plus
Version: 1.7.8
Author: Elementor.com
Imagify
Version: 2.3.0
Author: Imagify Image Optimizer – Optimize Images & Convert WebP & Avif
Rank Math SEO
Version: 1.0.274.1
Author: Rank Math SEO
Rank Math SEO PRO
Version: 3.0.117
Author: Rank Math SEO
Redis Object Cache
Version: 2.8.0
Author: Till Krüss
WP Fastest Cache
Version: 1.4.9
Author: Emre Vona
WP Fastest Cache Premium
Version: 1.7.6
Author: Emre Vona
Yoast Duplicate Post
Version: 4.7
Author: Enrico Battocchi & Team Yoast
== Elements Usage ==
page : 1
container : 5
heading : 4
icon-list : 2
image : 1
text-editor : 1
wp-post : 1
container : 2
html : 1
wp-page : 7
container : 8
html : 7
posts : 1
ehp-header : 1
container : 1
ehp-header : 1
== Settings ==
cpt_support: post, page
allow_tracking: yes
unfiltered_files_upload: 1
font_display: swap
== Features ==
Custom Fonts: 0
Custom Icons: 0
== Integrations ==
== Elementor Experiments ==
Inline Font Icons: Active
Additional Custom Breakpoints: Active
Container: Active
Optimized Markup: Active
Panel Promotions: Active by default
Default to New Theme Builder: Active
Header & Footer: Active by default
Elementor MCP WP Abilities API: Inactive by default
Pro Free Trial Popup: Inactive by default
Nested Elements: Active
Pages Panel: Inactive by default
Atomic Widgets: Active
V4 Indications Popover: Inactive by default
Enforce atomic widgets capabilities: Active by default
Editor MCP for atomic widgets: Active by default
Backward compatibility migrations: Active by default
Global Classes: Active
Enforce global classes capabilities: Active by default
Variables: Active
Variables Manager: Active by default
Editor v4 (Opt In Page): Active by default
Editor V4: Active
Components: Active
Interactions: Active by default
Widget Creation: Active by default
Generate website markdown: Inactive by default
Dynamic Assets Management: Inactive by default
Import/Export Customization: Active by default
Site Builder: Inactive by default
Elementor Editor Events: Inactive by default
Atomic Form: Active by default
Loop: Active by default
Menu: Active
Size Variables: Active by default
Pro Interactions: Active by default
In-Editor Feedback: Inactive by default
== Log ==
Log: showing 20 of 382026-07-15 21:43:23 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor',
'from' => '4.1.4',
'to' => '4.1.5',
)]
2026-07-15 21:43:36 [info] elementor::elementor_updater Started
2026-07-15 21:43:36 [info] Elementor/Upgrades - _on_each_version Start
2026-07-15 21:43:36 [info] Elementor/Upgrades - _on_each_version Finished
2026-07-15 21:43:36 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor',
'from' => '4.1.4',
'to' => '4.1.5',
)]
2026-07-16 10:11:12 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor Pro',
'from' => '4.1.2',
'to' => '4.1.3',
)]
2026-07-16 10:54:04 [info] elementor-pro::elementor_pro_updater Started
2026-07-16 10:54:04 [info] Elementor Pro/Upgrades - _on_each_version Start
2026-07-16 10:54:04 [info] Elementor Pro/Upgrades - _on_each_version Finished
2026-07-16 10:54:04 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor Pro',
'from' => '4.1.2',
'to' => '4.1.3',
)]
2026-07-20 20:09:51 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor',
'from' => '4.1.5',
'to' => '4.2.0',
)]
2026-07-20 20:09:51 [info] Elementor data updater process has been queued. [array (
'plugin' => 'Elementor Pro',
'from' => '4.1.3',
'to' => '4.2.0',
)]
2026-07-20 20:09:51 [info] elementor::elementor_updater Started
2026-07-20 20:09:51 [info] Elementor/Upgrades - _on_each_version Start
2026-07-20 20:09:52 [info] Elementor/Upgrades - _on_each_version Finished
2026-07-20 20:09:52 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor',
'from' => '4.1.5',
'to' => '4.2.0',
)]
2026-07-20 20:09:52 [info] elementor-pro::elementor_pro_updater Started
2026-07-20 20:09:52 [info] Elementor Pro/Upgrades - _on_each_version Start
2026-07-20 20:09:52 [info] Elementor Pro/Upgrades - _on_each_version Finished
2026-07-20 20:09:52 [info] Elementor data updater process has been completed. [array (
'plugin' => 'Elementor Pro',
'from' => '4.1.3',
'to' => '4.2.0',
)]
JS: showing 2 of 2JS: 2026-07-01 18:35:55 [error X 1][../elementor/assets/js/packages/editor-elements-panel/editor-elements-panel.min.js?ver=4.1.4:1:2342] Elementor Elements Panel wrapper element not found
JS: 2026-07-23 13:28:55 [error X 2][../elementor/assets/js/admin.min.js?ver=4.2.0:2:42363] r.startsWith is not a function
PHP: showing 2 of 2PHP: 2026-07-20 20:09:52 [notice X 7][../elementor/modules/global-classes/atomic-global-styles.php::410] Elementor\Modules\GlobalClasses\Atomic_Global_Styles::get_cache_root_key(): Implicitly marking parameter $key as nullable is deprecated, the explicit nullable type must be used instead [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2026-07-23 10:19:22 [error X 1][../elementor/modules/global-classes/atomic-global-styles.php::411] syntax error, unexpected token "return", expecting ";" or "{" [array (
'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
== Elementor - Compatibility Tag ==
Elementor Pro: Compatible
== Elementor Pro - Compatibility Tag ==
```
### Agreement
- [ ] I confirm I have read and followed all the guidelines and instructions outlined in the Elementor Bug Report form.
- [x] I agree that my issue may be closed without further action if it doesn't meet all the requirements outlined in the Elementor Bug Report form.
Contributor guide
Research direction
Open wp-content/plugins/elementor/modules/global-classes/atomic-global-styles.php at line 410 and inspect get_cache_root_key(). Run the documented WP-CLI bootstrap command with PHP 8.4 or 8.5 and deprecation reporting enabled. Done means the explicit nullable declaration is syntax-valid and WordPress loads without this deprecation notice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100