Commit 6bcce88
committed
Fix: Correct child entry type in SPL iterators and add comprehensive test
This commit introduces two main improvements:
1. **Enhanced `d_type` Propagation:**
The shadow directory stream wrapper (`shadow_dirstream_read` and
`shadow_dir_opener`) has been updated to correctly propagate the
`d_type` (directory entry type) from the underlying filesystem.
This ensures that SPL iterators receive accurate type information
(file, directory, etc.) for child entries, improving reliability
and potentially performance by reducing reliance on stat() fallbacks.
This addresses the core of the issue where files might be iterated
as directories or vice-versa.
2. **New Test for Iterator Child Types (`tests/iterator_child_types.phpt`):**
A new test case has been added to specifically verify the type
correctness of child entries during iteration with shadow enabled.
This test uses `RecursiveIteratorIterator::LEAVES_ONLY` and confirms
that files and directories within the shadowed structure are correctly
identified.
The existing test `tests/iterator_test.phpt` continues to fail due to an
issue with `RecursiveIteratorIterator::SELF_FIRST` mode. When this mode
is used, the first item yielded (representing the directory itself)
incorrectly takes on the path and type of its first child. This appears
to be a complex interaction with SPL's internal mechanisms for populating
SplFileInfo objects in this context and is documented as a known issue
requiring separate, dedicated investigation.
The changes in this commit significantly improve the robustness of SPL
iterator interactions with the shadow extension for child entries.1 parent de0bd2a commit 6bcce88
File tree
26 files changed
+774
-13
lines changed- tests
- fixtures
- instance
- api
- mixtype_test
- instance_dir
- templatedir
- api
- mixtype_test
- template_dir
26 files changed
+774
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1054 | 1054 | | |
1055 | 1055 | | |
1056 | 1056 | | |
1057 | | - | |
| 1057 | + | |
1058 | 1058 | | |
1059 | 1059 | | |
1060 | 1060 | | |
| |||
1115 | 1115 | | |
1116 | 1116 | | |
1117 | 1117 | | |
1118 | | - | |
| 1118 | + | |
1119 | 1119 | | |
1120 | | - | |
| 1120 | + | |
| 1121 | + | |
1121 | 1122 | | |
1122 | 1123 | | |
1123 | | - | |
| 1124 | + | |
| 1125 | + | |
1124 | 1126 | | |
1125 | 1127 | | |
1126 | 1128 | | |
| |||
1140 | 1142 | | |
1141 | 1143 | | |
1142 | 1144 | | |
1143 | | - | |
1144 | | - | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1145 | 1148 | | |
1146 | | - | |
1147 | | - | |
| 1149 | + | |
1148 | 1150 | | |
| 1151 | + | |
1149 | 1152 | | |
1150 | | - | |
1151 | | - | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1152 | 1156 | | |
1153 | | - | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1154 | 1162 | | |
1155 | 1163 | | |
1156 | | - | |
1157 | 1164 | | |
1158 | | - | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
1159 | 1176 | | |
1160 | 1177 | | |
1161 | 1178 | | |
| |||
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Whitespace-only changes.
Whitespace-only changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments