File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -267,14 +267,14 @@ public static function isSeekableStream($resource)
267267 *
268268 * @param resource $resource
269269 *
270- * @return int stream size
270+ * @return int|null stream size
271271 */
272272 public static function getStreamSize ($ resource )
273273 {
274274 $ stat = fstat ($ resource );
275275
276276 if ( ! is_array ($ stat ) || ! isset ($ stat ['size ' ])) {
277- throw new RuntimeException ( ' Cannot stat resource. Remote files are not supported. ' ) ;
277+ return null ;
278278 }
279279
280280 return $ stat ['size ' ];
Original file line number Diff line number Diff line change @@ -170,6 +170,13 @@ public function testStreamSize()
170170 fclose ($ stream );
171171 }
172172
173+ public function testStreamSizeForUrl ()
174+ {
175+ $ stream = \fopen ('https://flysystem.thephpleague.com/img/flysystem.svg ' , 'r ' );
176+ $ this ->assertNull (Util::getStreamSize ($ stream ));
177+ fclose ($ stream );
178+ }
179+
173180 public function testRewindStream ()
174181 {
175182 $ stream = tmpfile ();
You can’t perform that action at this time.
0 commit comments