Commit 662605d
committed
Add - Pin the sanitize_key() collapse cases in state_compact().
Requested independently by both reviewers on the rate-table seam PR: the changelog
cites a non-Latin state as the motivating case, but no provider row exercised one,
so the behavior rested on reasoning rather than on a test.
Adds five rows. Three collapse to empty outright (Cyrillic, CJK, a bare
diacritic). Two collapse only partially -- 'IF' with a circumflex becomes 'F',
'AL' with a ring above becomes 'L' -- and those are the dangerous shape, because
the result is a shorter but still perfectly plausible state code. That is exactly
the duplication path this seam exists to close: the row is stored under the
collapsed value and looked up under the raw one, so it can never be found again
and a fresh row is inserted on every calculation.
Expected values were read off WordPress's own sanitize_key() rather than derived
by hand; the test's existing second assertion re-checks that agreement per row.
All five fail against the pre-migration str_replace() implementation.1 parent db19683 commit 662605d
1 file changed
Lines changed: 29 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
834 | 834 | | |
835 | 835 | | |
836 | 836 | | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
837 | 850 | | |
838 | 851 | | |
839 | 852 | | |
840 | 853 | | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
848 | 870 | | |
849 | 871 | | |
850 | 872 | | |
| |||
0 commit comments