Commit 7a7652e
committed
Editor: Handle nested array block gap values properly.
Guard against non-scalar (nested array) `blockGap` values in
`wp_sanitize_block_gap_value()` before passing them to `preg_match()`,
which requires a string subject. A malformed axial gap value such as
`blockGap.top` being `array( '1rem' )` previously triggered an uncaught
`TypeError`, breaking front-end rendering and REST API responses.
Includes a direct unit test for `wp_sanitize_block_gap_value()` and a
data provider case in `Tests_Block_Supports_Layout` covering rendering
with a malformed axial block gap.
Developed in WordPress#12604.
Ports WordPress/gutenberg#80464 to Core.
Props tyxla, ramonopoly.
Fixes #65667.
git-svn-id: https://develop.svn.wordpress.org/trunk@62801 602fd350-edb4-49c9-b593-d223f7449a821 parent 9ace411 commit 7a7652e
2 files changed
Lines changed: 47 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
85 | 105 | | |
86 | 106 | | |
87 | 107 | | |
| |||
235 | 255 | | |
236 | 256 | | |
237 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
238 | 284 | | |
239 | 285 | | |
240 | 286 | | |
| |||
0 commit comments