Commit 16aa10f
committed
HTML API: Fix missing null-check in wp_kses_hair() refactor.
When no attributes are present, `wp_kses_hair()` should return an empty
array, but when the refactor was merged, the code assumed there would be
attributes.
An alternative fix is to use null-coalescing to iterate over an empty
array. This would produce a marginally smaller function and read
slightly more cleanly, but there’s no need to enter the `foreach` loop
when it’s known in advance that there’s nothing over which to iterate.
Developed in: WordPress#10758
Discussed in: https://core.trac.wordpress.org/ticket/63724
Follow-up to [61467].
Props: dd32, dmsnell, jonsurrell.
See: #63724.
git-svn-id: https://develop.svn.wordpress.org/trunk@61499 602fd350-edb4-49c9-b593-d223f7449a821 parent cfa06b1 commit 16aa10f
2 files changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1623 | 1623 | | |
1624 | 1624 | | |
1625 | 1625 | | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
1626 | 1631 | | |
1627 | 1632 | | |
1628 | 1633 | | |
| |||
1631 | 1636 | | |
1632 | 1637 | | |
1633 | 1638 | | |
1634 | | - | |
| 1639 | + | |
1635 | 1640 | | |
1636 | 1641 | | |
1637 | 1642 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
42 | 64 | | |
43 | 65 | | |
44 | 66 | | |
| |||
0 commit comments