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

Post Tags - link color gives PHP error if post untagged #35769

Closed
Sandstromer opened this issue Oct 19, 2021 · 0 comments · Fixed by #35836
Closed

Post Tags - link color gives PHP error if post untagged #35769

Sandstromer opened this issue Oct 19, 2021 · 0 comments · Fixed by #35836
Assignees
Labels
[Block] Post Terms Affects the Post Terms Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@Sandstromer
Copy link

Sandstromer commented Oct 19, 2021

Description

When using the Post Tags block and setting a link color, the front end gives PHP errors, when a post is untagged:

Notice: Undefined offset: 0 in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 47

Notice: Trying to access array offset on value of type null in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 47

Notice: Undefined offset: 0 in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 59

Notice: Trying to access array offset on value of type null in C:\xampp\apps\wordpress\htdocs\wp-content\plugins\gutenberg\lib\block-supports\elements.php on line 59

Looks like trying to add the wp-elements-xxxxx class to a non-existant Post Tag block.

I think the error would also surface for the Post Categories block, if it wasn't for the fact that when a post is uncategorized, the Post Categories block is rendered as 'Uncategorized'.

Step-by-step reproduction instructions

  1. In Site Editor add the Post Tags block to a template such as index.html
  2. Select a link color for the Post Tags block
  3. View front end and notice the error when any of the posts are untagged.

Screenshots, screen recording, code snippet

post-tags-link-color-editor

post-tags-link-color-front-php-error

post-tags-link-color-front-class-output

Environment info

WP 5.8.1
Gutenberg 11.7
Theme TT1-Blocks

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@Mamaduka Mamaduka added the [Type] Bug An existing feature does not function as intended label Oct 20, 2021
@carolinan carolinan added the [Block] Post Terms Affects the Post Terms Block label Oct 21, 2021
@carolinan carolinan self-assigned this Oct 21, 2021
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Terms Affects the Post Terms Block [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