Commit 99fa865
committed
bug #50884 [Finder] Fix initial directory is opened twice (mvorisek)
This PR was squashed before being merged into the 5.4 branch.
Discussion
----------
[Finder] Fix initial directory is opened twice
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #50851
| License | MIT
| Doc PR | no
The issue was introduced in #8120 which was coded wrongly for several reasons:
- `seekable` support is about file/stream content seeking, not about rewind support, non-seekable stream handler can support rewind - it worked by coincidence
- the original code involved additional directory open (syscall), which is/was slow
- 1st rewind of DirectoryIterator is implicit, ie. it is not needed - again, skipping the rewind worked by coincidence
- 2nd+ rewind must fail if it is not supported, the original code silently skipped it
The test from #8120 is kept and is passing.
I also improved the ftp support detection to make the test stricter.
To support rewind for ftp I opened - php/php-src#11597 - but this Symfony PR does not need it.
Commits
-------
d3f03be [Finder] Fix initial directory is opened twiceFile tree
2 files changed
+22
-34
lines changed- src/Symfony/Component/Finder
- Iterator
- Tests/Iterator
2 files changed
+22
-34
lines changedLines changed: 13 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | 121 | | |
123 | 122 | | |
124 | 123 | | |
| |||
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
132 | | - | |
133 | | - | |
134 | 131 | | |
135 | 132 | | |
136 | 133 | | |
137 | | - | |
| 134 | + | |
138 | 135 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 136 | + | |
142 | 137 | | |
143 | | - | |
| 138 | + | |
144 | 139 | | |
145 | 140 | | |
146 | 141 | | |
147 | | - | |
148 | | - | |
149 | | - | |
| 142 | + | |
150 | 143 | | |
151 | | - | |
| 144 | + | |
| 145 | + | |
152 | 146 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
160 | 151 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 152 | + | |
164 | 153 | | |
165 | 154 | | |
166 | | - | |
| 155 | + | |
167 | 156 | | |
168 | 157 | | |
Lines changed: 9 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 30 | + | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
0 commit comments