Security update for Core, with self-updated composer
[yaffs-website] / vendor / zendframework / zend-diactoros / src / Stream.php
index 6a04e2b9b1854119f5b16fa8a705e66187cda5a7..af84d9b91c9390cff9c8864cf398ee3583820e95 100644 (file)
@@ -1,9 +1,7 @@
 <?php
 /**
- * Zend Framework (http://framework.zend.com/)
- *
- * @see       http://github.com/zendframework/zend-diactoros for the canonical source repository
- * @copyright Copyright (c) 2015-2016 Zend Technologies USA Inc. (http://www.zend.com)
+ * @see       https://github.com/zendframework/zend-diactoros for the canonical source repository
+ * @copyright Copyright (c) 2015-2017 Zend Technologies USA Inc. (http://www.zend.com)
  * @license   https://github.com/zendframework/zend-diactoros/blob/master/LICENSE.md New BSD License
  */
 
@@ -48,7 +46,10 @@ class Stream implements StreamInterface
         }
 
         try {
-            $this->rewind();
+            if ($this->isSeekable()) {
+                $this->rewind();
+            }
+
             return $this->getContents();
         } catch (RuntimeException $e) {
             return '';
@@ -102,7 +103,11 @@ class Stream implements StreamInterface
         }
 
         $stats = fstat($this->resource);
-        return $stats['size'];
+        if ($stats !== false) {
+            return $stats['size'];
+        }
+
+        return null;
     }
 
     /**