Commit fe2dc2b
authored
Avoid crash for reset/end/next/prev() on ffi classes (php#9711)
(And any PECLs returning `zend_empty_array` in the handler->get_properties
overrides)
Closes phpGH-9697
This is similar to the fix used in d9651a9
for array_walk.
This should make it safer for php-src (and PECLs, long-term) to return
the empty immutable array in `handler->get_properties` to avoid wasting memory.
See php#9697 (comment)
The only possible internal iterator position for the empty array is at the end
of the empty array (nInternalPointer=0).
The `zend_hash*del*` helpers will always set nInternalPointer to 0 when an
array becomes empty,
regardless of previous insertions/deletions/updates to the array.1 parent f7e6784 commit fe2dc2b
3 files changed
+38
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1073 | 1073 | | |
1074 | 1074 | | |
1075 | 1075 | | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1076 | 1080 | | |
1077 | 1081 | | |
1078 | 1082 | | |
| |||
1100 | 1104 | | |
1101 | 1105 | | |
1102 | 1106 | | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
1103 | 1111 | | |
1104 | 1112 | | |
1105 | 1113 | | |
| |||
1127 | 1135 | | |
1128 | 1136 | | |
1129 | 1137 | | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1130 | 1142 | | |
1131 | 1143 | | |
1132 | 1144 | | |
| |||
1154 | 1166 | | |
1155 | 1167 | | |
1156 | 1168 | | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1157 | 1173 | | |
1158 | 1174 | | |
1159 | 1175 | | |
| |||
0 commit comments