File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 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.
99
1010## Unreleased
1111
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.
1220
1321## [ 1.7.1] - 2018-10-29
1422
Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ abstract class FilteredStream implements StreamInterface
1515{
1616 const BUFFER_SIZE = 8192 ;
1717
18- use StreamDecorator;
18+ use StreamDecorator {
19+ rewind as private doRewind;
20+ seek as private doSeek;
21+ }
1922
2023 /**
2124 * @var callable
@@ -146,11 +149,11 @@ public function getContents()
146149 }
147150
148151 /**
149- * {@inheritdoc}
152+ * Always returns null because we can't tell the size of a stream when we filter.
150153 */
151154 public function getSize ()
152155 {
153- return ;
156+ return null ;
154157 }
155158
156159 /**
@@ -162,7 +165,9 @@ public function __toString()
162165 }
163166
164167 /**
165- * {@inheritdoc}
168+ * Filtered streams are not seekable.
169+ *
170+ * We would need to buffer and process everything to allow seeking.
166171 */
167172 public function isSeekable ()
168173 {
@@ -174,15 +179,17 @@ public function isSeekable()
174179 */
175180 public function rewind ()
176181 {
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 ();
178184 }
179185
180186 /**
181187 * {@inheritdoc}
182188 */
183189 public function seek ($ offset , $ whence = SEEK_SET )
184190 {
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 );
186193 }
187194
188195 /**
You can’t perform that action at this time.
0 commit comments