diff vendor/guzzlehttp/psr7/src/StreamWrapper.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/vendor/guzzlehttp/psr7/src/StreamWrapper.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php	Thu Feb 28 13:21:36 2019 +0000
@@ -38,9 +38,21 @@
                 . 'writable, or both.');
         }
 
-        return fopen('guzzle://stream', $mode, null, stream_context_create([
+        return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream));
+    }
+
+    /**
+     * Creates a stream context that can be used to open a stream as a php stream resource.
+     *
+     * @param StreamInterface $stream
+     *
+     * @return resource
+     */
+    public static function createStreamContext(StreamInterface $stream)
+    {
+        return stream_context_create([
             'guzzle' => ['stream' => $stream]
-        ]));
+        ]);
     }
 
     /**
@@ -94,12 +106,21 @@
         return true;
     }
 
+    public function stream_cast($cast_as)
+    {
+        $stream = clone($this->stream);
+
+        return $stream->detach();
+    }
+
     public function stream_stat()
     {
         static $modeMap = [
             'r'  => 33060,
+            'rb' => 33060,
             'r+' => 33206,
-            'w'  => 33188
+            'w'  => 33188,
+            'wb' => 33188
         ];
 
         return [
@@ -118,4 +139,23 @@
             'blocks'  => 0
         ];
     }
+
+    public function url_stat($path, $flags)
+    {
+        return [
+            'dev'     => 0,
+            'ino'     => 0,
+            'mode'    => 0,
+            'nlink'   => 0,
+            'uid'     => 0,
+            'gid'     => 0,
+            'rdev'    => 0,
+            'size'    => 0,
+            'atime'   => 0,
+            'mtime'   => 0,
+            'ctime'   => 0,
+            'blksize' => 0,
+            'blocks'  => 0
+        ];
+    }
 }