-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add check theme support is an array before indexing #23104
Conversation
Size Change: +113 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
There's the |
I updated the PR with the change suggested, the one thing I don't really like is the check gets added into the function, when technically it shouldn't need it. The function should be able to assume it was called correctly, but it does simplify things. |
Description
Adds checks for return value from get_theme_support to validate it returns an array of at least size 1 that can be indexed into.
The get_theme_support may return false, and attempting to indexing causes a PHP notice.
Fixes #23085
How has this been tested?
Use a theme that does not support Global Styles, I had a Twenty Nineteen theme, but may not have been the most up-to-date.
Turn on PHP notice warnings as visible.
Load editor. Confirm warning does not show after fix.
Types of changes
Adds a couple of additional checks of the value returned from
get_theme_support()