Commit c57aa56
committed
Query: Prevent fatal TypeError when taxonomy query var is an array.
When a URL contains array-style GET parameters for a hierarchical
taxonomy (e.g. ?category_name[]=foo), wp_basename() receives an array
instead of a string, causing a fatal TypeError on PHP 8+.
Added is_string() check before calling wp_basename() on the taxonomy
query var value. The existing is_array() check on the next line already
handles array values correctly, so this change only prevents the crash.
Adds a unit test to verify the query completes without a TypeError
when a hierarchical taxonomy query var is passed as an array.
Props patricedefago.
Fixes #64870.1 parent dea662b commit c57aa56
2 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1189 | 1189 | | |
1190 | 1190 | | |
1191 | 1191 | | |
1192 | | - | |
| 1192 | + | |
1193 | 1193 | | |
1194 | 1194 | | |
1195 | 1195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
236 | 265 | | |
0 commit comments