You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(admin): prevent PHP 8.1+ deprecation notices and undefined key warnings in Admin::enqueue_scripts() #549
In includes/Admin/Admin.php (lines 1190–1197), enqueue_scripts() calls get_option() for fb_copy_paste_style, fb_automatic_block_recovery, and fb_enable_quick_action_bar, and passes the return value directly to trim():
On a fresh installation (or before those options are saved), get_option() returns false (or null if filtered). Additionally, lines 1237–1245 access $theme_json['color']['defaultGradients'] without isset() / !empty(). On PHP 8.1+, passing non-string values to trim() or reading undefined array keys emits deprecation notices and warnings in wp-admin.
Steps to Reproduce
Enable WP_DEBUG on PHP 8.1, 8.2, or 8.3 on a site where fb_copy_paste_style / fb_automatic_block_recovery / fb_enable_quick_action_bar have not yet been saved.
Visit the WordPress Admin or Block Editor.
Check the PHP error log for trim() / undefined array key notices from includes/Admin/Admin.php.
Expected Behavior
Cast get_option(..., '') to (string) before calling trim(), and guard !empty($theme_json['color']['defaultGradients']) && isset($theme_json['color']['gradients']['default']) with isset() / is_array() checks so zero PHP warnings or deprecations are emitted on PHP 8.1+.
Activity