Skip to content
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

Fix undefined index "colors" warning (#2198) #2253

Closed
wants to merge 1 commit into from
Closed

Fix undefined index "colors" warning (#2198) #2253

wants to merge 1 commit into from

Conversation

Axinet
Copy link

@Axinet Axinet commented Aug 6, 2017

No description provided.

@nylen
Copy link
Member

nylen commented Aug 6, 2017

This resolves one of the two notices related to #2198. There is still another one:

PHP Error Location
Notice: Undefined index: wide-images wp-content/plugins/gutenberg/lib/client-assets.php:660

For that reason I think it would be better to follow the other proposed solution in #2198 ("provide abstraction (function getter) to retrieve Gutenberg theme options").

Also, if you put "Fixes #2198" in your PR description it will automatically close that issue when this PR is merged, as well as being a clearer link back to the original issue.

@@ -652,7 +652,7 @@ function gutenberg_editor_scripts_and_styles( $hook ) {
$gutenberg_theme_support = get_theme_support( 'gutenberg' );
$color_palette = gutenberg_color_palette();

if ( $gutenberg_theme_support && $gutenberg_theme_support[0]['colors'] ) {
if ( $gutenberg_theme_support && isset( $gutenberg_theme_support[0]['colors'] ) && $gutenberg_theme_support[0]['colors'] ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to test having been set and "truthy"-ness, would it be more concise to use ! empty instead?

if ( $gutenberg_theme_support && ! empty( $gutenberg_theme_support[0]['colors'] ) ) {

http://php.net/manual/en/types.comparisons.php

@gziolo
Copy link
Member

gziolo commented Oct 11, 2017

@Axinet thanks opening this PR. We have a fix for this one in #2982 which addresses the comment left by @nylen, too. I'm closing this one.

@gziolo gziolo closed this Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants