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

PHP notice in global-styles.php #23085

Closed
johngodley opened this issue Jun 11, 2020 · 0 comments · Fixed by #23104
Closed

PHP notice in global-styles.php #23085

johngodley opened this issue Jun 11, 2020 · 0 comments · Fixed by #23104
Assignees
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@johngodley
Copy link
Contributor

Using Gutenberg 8.3.0 I get this PHP warning on every front-end page access, as well as the editor:

Notice: Trying to access array offset on value of type bool in wp-content/plugins/gutenberg/lib/global-styles.php on line 212

The code carries on working regardless.

The line is:

$theme_gradients = get_theme_support( 'editor-gradient-presets' )[0];

Looking at the code for get_theme_support, it can return a false. It's probably worth adding a check for this before accessing it as an array.

It currently happens in master too.

This is for the theme Twenty Twenty. I note there is an update pending for this on my test site, so it's possible theme support was added. However, the notice should be fixed for themes that don't have support.

To reproduce
Steps to reproduce the behavior:

  1. Install Gutenberg 8.3.0
  2. Ensure you have PHP error reporting set to show notices
  3. Load a front end page or the editor
@johngodley johngodley added [Type] Bug An existing feature does not function as intended Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Jun 11, 2020
@oandregal oandregal self-assigned this Jun 11, 2020
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants