File tree 2 files changed +21
-6
lines changed
2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
9
9
10
10
## Unreleased
11
11
12
+ ## [ 1.7.2] - 2018-10-30
13
+
14
+ ### Fixed
15
+
16
+ - FilteredStream uses ` @trigger_error ` instead of throwing exceptions to not
17
+ break careless users. You still need to fix your stream code to respect
18
+ ` isSeekable ` . Seeking does not work as expected, and we will add exceptions
19
+ in version 2.
12
20
13
21
## [ 1.7.1] - 2018-10-29
14
22
Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ abstract class FilteredStream implements StreamInterface
15
15
{
16
16
const BUFFER_SIZE = 8192 ;
17
17
18
- use StreamDecorator;
18
+ use StreamDecorator {
19
+ rewind as private doRewind;
20
+ seek as private doSeek;
21
+ }
19
22
20
23
/**
21
24
* @var callable
@@ -146,11 +149,11 @@ public function getContents()
146
149
}
147
150
148
151
/**
149
- * {@inheritdoc}
152
+ * Always returns null because we can't tell the size of a stream when we filter.
150
153
*/
151
154
public function getSize ()
152
155
{
153
- return ;
156
+ return null ;
154
157
}
155
158
156
159
/**
@@ -162,7 +165,9 @@ public function __toString()
162
165
}
163
166
164
167
/**
165
- * {@inheritdoc}
168
+ * Filtered streams are not seekable.
169
+ *
170
+ * We would need to buffer and process everything to allow seeking.
166
171
*/
167
172
public function isSeekable ()
168
173
{
@@ -174,15 +179,17 @@ public function isSeekable()
174
179
*/
175
180
public function rewind ()
176
181
{
177
- throw new \RuntimeException ('Cannot rewind a filtered stream ' );
182
+ @trigger_error ('Filtered streams are not seekable. This method will start raising an exception in the next major version ' , E_USER_DEPRECATED );
183
+ $ this ->doRewind ();
178
184
}
179
185
180
186
/**
181
187
* {@inheritdoc}
182
188
*/
183
189
public function seek ($ offset , $ whence = SEEK_SET )
184
190
{
185
- throw new \RuntimeException ('Cannot seek a filtered stream ' );
191
+ @trigger_error ('Filtered streams are not seekable. This method will start raising an exception in the next major version ' , E_USER_DEPRECATED );
192
+ $ this ->doSeek ($ offset , $ whence );
186
193
}
187
194
188
195
/**
You can’t perform that action at this time.
0 commit comments