Commit 42652a8
committed
REST API: Add missing properties in block node arrays.
There have been a few places in WordPress where a method creates “an array representation simulating the output of parse_blocks”, but the array is missing one or more keys.
The missing keys cause issue with downstream code, which either treats a block without, for example, `innerBlocks` as invalid input, or more commonly, assumes that `innerBlocks` is present and accesses it unconditionally. This can even lead to crashes.
This patch adds the missing properties so that the code behaves as expected. Since the array values are empty by default, adding these missing keys does not present any intentional behavioral changes — only a safer default.
Developed in: WordPress#10735
Discussed in: https://core.trac.wordpress.org/ticket/64505
Follow-up to [47360], [57354].
Props dlh, dmsnell, mukesh27, westonruter.
Fixes #64505.
git-svn-id: https://develop.svn.wordpress.org/trunk@62039 602fd350-edb4-49c9-b593-d223f7449a821 parent 4e321a5 commit 42652a8
2 files changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
971 | 971 | | |
972 | 972 | | |
973 | 973 | | |
| 974 | + | |
974 | 975 | | |
975 | 976 | | |
976 | 977 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| |||
0 commit comments