Commit 2eb539d
committed
system: use is_int()/array_key_first() in toArray() and fromArray() #9485
The approximation of the magic here is that we are looking for array
elements created by a natural append [] = or equivalent which has
an integer key of a rough range of 0 to count() - 1, but not always as
we can see from the ticket.
unset() breaks the pledge of sequential lists and makes array_is_list()
fail. Sorting would also break the sequential pledge without resetting
the keyes using array_values() but that approach is too broad.
Instead, get a single key we can do a strict int type check on so that
we are as likely to succeed as was the case before the change in 7ee3b2c.
It's also fast. ;)1 parent 9e80580 commit 2eb539d
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
0 commit comments