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
If visiting a wordpress page where I removed admin bar styles, AMP throws Warning: Undefined array key "admin-bar" in XXX/wp-content/plugins/amp/includes/class-amp-theme-support.php on line 1382
I removed the styles (and the whole admin bar) with
Thanks for the suggestion, I'll look into that. But adding an isset() is a good practice anyway, one should always check if a property exists before using it, don't you think so?
Bug Description
If visiting a wordpress page where I removed admin bar styles, AMP throws
Warning: Undefined array key "admin-bar" in XXX/wp-content/plugins/amp/includes/class-amp-theme-support.php on line 1382
I removed the styles (and the whole admin bar) with
If I take out
wp_deregister_style( 'admin-bar' );
it works again.Expected Behaviour
Should not throw warning
Screenshots
No response
PHP Version
8.2
Plugin Version
2.5.3
AMP plugin template mode
Standard
WordPress Version
No response
Site Health
No response
Gutenberg Version
No response
OS(s) Affected
No response
Browser(s) Affected
No response
Device(s) Affected
No response
Acceptance Criteria
No response
Implementation Brief
on line 1382 includes/class-amp-theme-support.php you should replace
is_array( wp_styles()->registered['admin-bar']->deps ) && in_array( $handle, wp_styles()->registered['admin-bar']->deps, true ) ? [..]
by
isset( wp_styles()->registered['admin-bar']->deps ) && is_array( wp_styles()->registered['admin-bar']->deps ) && in_array( $handle, wp_styles()->registered['admin-bar']->deps, true ) ? [..]
(add an isset())
QA Testing Instructions
No response
Demo
No response
Changelog Entry
No response
The text was updated successfully, but these errors were encountered: