Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#56291 closed defect (bug) (fixed)

Theme JSON: Fix notice when unknown elements are specified

Reported by: scruffian's profile scruffian Owned by:
Milestone: 6.1 Priority: normal
Severity: normal Version: 5.8
Component: General Keywords: has-patch needs-testing close
Focuses: Cc:

Description

If a theme.json file specifies an unknown element then we'll get a notice from line 1482 in this file. This adds an array_key_exists check before we get the value of the array at that key, to avoid the notice.

Gutenberg issue: WordPress/gutenberg#42649
GitHub PR: https://github.com/WordPress/wordpress-develop/pull/3026

Attachments (1)

patch.diff (758 bytes) - added by scruffian 3 years ago.

Download all attachments as: .zip

Change History (18)

@scruffian
3 years ago

This ticket was mentioned in PR #3026 on WordPress/wordpress-develop by scruffian.


3 years ago
#1

  • Keywords has-patch added

If a theme.json file specifies an unknown element then we'll get a notice from line 1482 in this file. This adds an array_key_exists check before we get the value of the array at that key, to avoid the notice.

Gutenberg issue: https://github.com/WordPress/gutenberg/issues/42649
Trac issue: https://core.trac.wordpress.org/ticket/56291

#2 @rudlinkon
3 years ago

@scruffian thanks for your PR. I checked it yesterday and it looks good to me.

#3 @audrasjb
3 years ago

  • Keywords needs-testing added

@rudlinkon this PR was opened 27 minutes ago :)
Could you please share some reproductions steps to help others to test it as well?

#4 @hztyfoon
3 years ago

No, the PR was created yesterday @audrasjb 🙂
I also reviewed it.

#5 @audrasjb
3 years ago

Reviewing is cool, but could you please also share your steps to reproduce the issue and to test the patch? Thanks 🙂

#6 @audrasjb
3 years ago

I added some unknown elements in TT2 theme.json file and I don't have any warning on my side.

(I of course have the WP_DEBUG constant set to true)

#7 @hztyfoon
3 years ago

Thanks @audrasjb,

Ok, here's the Step-by-step reproduction instructions (created by @ndiego): https://github.com/WordPress/gutenberg/issues/42649#issue-1315463508

I tested it myself with gutenberg 13.7 & found the issue as created by @ndiego.
And also tested the PR's fix & it solved the issue.

#8 @rudlinkon
3 years ago

@audrasjb here is the instruction https://github.com/WordPress/gutenberg/issues/42649 could you please follow this instruction?

Last edited 3 years ago by rudlinkon (previous) (diff)

#9 @audrasjb
3 years ago

OK so testing this issue requires to install gutenberg plugin, version 13.7.
Thanks for this important info, it was clearly missing here.

#10 @audrasjb
3 years ago

  • Milestone changed from Awaiting Review to 6.1
  • Version set to 5.8

Introduced in [50973] (WP 5.8).

#11 @hztyfoon
3 years ago

hey @scruffian ,

I think U tried to mention the gutenberg link (https://github.com/WordPress/gutenberg/issues/42649) which I shared in my last comment.
Instead U ended up mentioning another unrelated trac ticket.

No worries, this thing happens.
Can U update the description and correct the gutenebrg issue link there? @scruffian

#12 in reply to: ↑ description @hztyfoon
3 years ago

Sorry @scruffian,
May be U cannot edit the description of the ticket But You can reply the description with quoting the gutenberg issue line.

Like this:
Replying to scruffian:

Gutenberg issue: WordPress/gutenberg#42649

the gutenebrg issue link is this: https://github.com/WordPress/gutenberg/issues/42649

Can U please confirm that the link I just mentioned in the reply is the correct one? @scruffian 🙂

#13 @scruffian
3 years ago

Yeah, sorry I used a shortcode by mistake. The link should be https://github.com/WordPress/gutenberg/issues/42649

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


3 years ago

#15 @audrasjb
3 years ago

  • Keywords close added

Hello,

This appears to be fixed upstream in Gutenberg. As it should probably be backported with other Gutenberg changes, we'll probably close this ticket as fixed.
For the moment, let's keep it open to track the issue.

scruffian commented on PR #3026:


3 years ago
#16

This was solved in a different way

#17 @audrasjb
3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Fixed upstream on Gutenberg's side.

Note: See TracTickets for help on using tickets.