diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
index b4aede3..fa37b12 100644
--- a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
@@ -138,6 +138,22 @@ public function stream_metadata($uri, $option, $value) {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function stream_set_option($option, $arg1, $arg2) {
+    trigger_error('stream_set_option() not supported for read-only stream wrappers', E_USER_WARNING);
+    return FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function stream_truncate($new_size) {
+    trigger_error('stream_truncate() not supported for read-only stream wrappers', E_USER_WARNING);
+    return FALSE;
+  }
+
+  /**
    * Support for unlink().
    *
    * The file will not be deleted from the stream as this is a read-only stream
diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
index 86d0e63..5869e71 100644
--- a/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/LocalStream.php
@@ -260,19 +260,9 @@ public function stream_eof() {
   }
 
   /**
-   * Support for fseek().
-   *
-   * @param int $offset
-   *   The byte offset to got to.
-   * @param int $whence
-   *   SEEK_SET, SEEK_CUR, or SEEK_END.
-   *
-   * @return bool
-   *   TRUE on success.
-   *
-   * @see http://php.net/manual/streamwrapper.stream-seek.php
+   * {@inheritdoc}
    */
-  public function stream_seek($offset, $whence) {
+  public function stream_seek($offset, $whence = SEEK_SET) {
     // fseek returns 0 on success and -1 on a failure.
     // stream_seek   1 on success and  0 on a failure.
     return !fseek($this->handle, $offset, $whence);
@@ -328,19 +318,10 @@ public function stream_close() {
   }
 
   /**
-   * Gets the underlying stream resource for stream_select().
-   *
-   * @param int $cast_as
-   *   Can be STREAM_CAST_FOR_SELECT or STREAM_CAST_AS_STREAM.
-   *
-   * @return resource|false
-   *   The underlying stream resource or FALSE if stream_select() is not
-   *   supported.
-   *
-   * @see http://php.net/manual/streamwrapper.stream-cast.php
+   * {@inheritdoc}
    */
   public function stream_cast($cast_as) {
-    return false;
+    return $this->handle ? $this->handle : FALSE;
   }
 
   /**
@@ -359,6 +340,16 @@ public function stream_metadata($uri, $option, $value) {
         }
         break;
 
+      case STREAM_META_OWNER_NAME:
+      case STREAM_META_OWNER:
+        $return = chown($target, $value);
+        break;
+
+      case STREAM_META_GROUP_NAME:
+      case STREAM_META_GROUP:
+        $return = chgrp($target, $value);
+        break;
+
       case STREAM_META_ACCESS:
         $return = chmod($target, $value);
         break;
@@ -372,6 +363,30 @@ public function stream_metadata($uri, $option, $value) {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function stream_set_option($option, $arg1, $arg2) {
+    switch ($option) {
+      case STREAM_OPTION_BLOCKING:
+        return stream_set_blocking($this->handle, $arg1);
+
+      case STREAM_OPTION_READ_TIMEOUT:
+        return stream_set_timeout($this->handle, $arg1, $arg2);
+
+      case STREAM_OPTION_WRITE_BUFFER:
+        return stream_set_write_buffer($this->handle, $arg1, $arg2);
+    }
+    return FALSE;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function stream_truncate($new_size) {
+    return ftruncate($this->handle, $new_size);
+  }
+
+  /**
    * Support for unlink().
    *
    * @param string $uri
diff --git a/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php b/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php
index ba19159..dadeb64 100644
--- a/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php
+++ b/core/lib/Drupal/Core/StreamWrapper/PhpStreamWrapperInterface.php
@@ -13,16 +13,82 @@
  * @see http://www.php.net/manual/class.streamwrapper.php
  */
 interface PhpStreamWrapperInterface {
-  public function stream_open($uri, $mode, $options, &$opened_url);
+
+  /* public $context; */
+
+  /**
+   * @return bool
+   */
+  public function dir_closedir();
+
+  /**
+   * @return bool
+   */
+  public function dir_opendir($path, $options);
+
+  /**
+   * @return string
+   */
+  public function dir_readdir();
+
+  /**
+   * @return bool
+   */
+  public function dir_rewinddir();
+
+  /**
+   * @return bool
+   */
+  public function mkdir($path, $mode, $options);
+
+  /**
+   * @return bool
+   */
+  public function rename($path_from, $path_to);
+
+  /**
+   * @return bool
+   */
+  public function rmdir($path, $options);
+
+  /**
+   * Retrieve the underlying stream resource.
+   *
+   * This method is called in response to stream_select().
+   *
+   * @param int $cast_as
+   *   Can be STREAM_CAST_FOR_SELECT when stream_select() is calling
+   *   stream_cast() or STREAM_CAST_AS_STREAM when stream_cast() is called for
+   *   other uses.
+   *
+   * @return resource|false
+   *   The underlying stream resource or FALSE if stream_select() is not
+   *   supported.
+   *
+   * @see stream_select()
+   * @see http://php.net/manual/streamwrapper.stream-cast.php
+   */
+  public function stream_cast($cast_as);
+
+  /**
+   * @return void
+   */
   public function stream_close();
-  public function stream_lock($operation);
-  public function stream_read($count);
-  public function stream_write($data);
+
+  /**
+   * @return bool
+   */
   public function stream_eof();
-  public function stream_seek($offset, $whence);
+
+  /**
+   * @return bool
+   */
   public function stream_flush();
-  public function stream_tell();
-  public function stream_stat();
+
+  /**
+   * @return bool
+   */
+  public function stream_lock($operation);
 
   /**
    * Sets metadata on the stream.
@@ -54,15 +120,111 @@ public function stream_stat();
    *
    * @see http://www.php.net/manual/streamwrapper.stream-metadata.php
    */
-  public function stream_metadata($uri, $option, $value);
+  public function stream_metadata($path, $option, $value);
+
+  /**
+   * @return bool
+   */
+  public function stream_open($path, $mode, $options, &$opened_path);
+
+  /**
+   * @return string
+   */
+  public function stream_read($count);
+
+  /**
+   * Seeks to specific location in a stream.
+   *
+   * This method is called in response to fseek().
+   *
+   * The read/write position of the stream should be updated according to the
+   * offset and whence.
+   *
+   * @param int $offset
+   *   The byte offset to seek to.
+   * @param int $whence
+   *   Possible values:
+   *   - SEEK_SET: Set position equal to offset bytes.
+   *   - SEEK_CUR: Set position to current location plus offset.
+   *   - SEEK_END: Set position to end-of-file plus offset.
+   *   Defaults to SEEK_SET.
+   *
+   * @return bool
+   *   TRUE if the position was updated, FALSE otherwise.
+   *
+   * @see http://php.net/manual/streamwrapper.stream-seek.php
+   */
+  public function stream_seek($offset, $whence = SEEK_SET);
+
+  /**
+   * Change stream options.
+   *
+   * This method is called to set options on the stream.
+   *
+   * @param int $option
+   *   One of:
+   *   - STREAM_OPTION_BLOCKING: The method was called in response to
+   *     stream_set_blocking().
+   *   - STREAM_OPTION_READ_TIMEOUT: The method was called in response to
+   *     stream_set_timeout().
+   *   - STREAM_OPTION_WRITE_BUFFER: The method was called in response to
+   *     stream_set_write_buffer().
+   * @param int $arg1
+   *   If option is:
+   *   - STREAM_OPTION_BLOCKING: The requested blocking mode:
+   *     - 1 means blocking.
+   *     - 0 means not blocking.
+   *   - STREAM_OPTION_READ_TIMEOUT: The timeout in seconds.
+   *   - STREAM_OPTION_WRITE_BUFFER: The buffer mode, STREAM_BUFFER_NONE or
+   *     STREAM_BUFFER_FULL.
+   * @param int $arg2
+   *   If option is:
+   *   - STREAM_OPTION_BLOCKING: This option is not set.
+   *   - STREAM_OPTION_READ_TIMEOUT: The timeout in microseconds.
+   *   - STREAM_OPTION_WRITE_BUFFER: The requested buffer size.
+   *
+   * @return bool
+   *   TRUE on success, FALSE otherwise. If $option is not implemented, FALSE
+   *   should be returned.
+   */
+  public function stream_set_option($option, $arg1, $arg2);
+
+  /**
+   * @return array
+   */
+  public function stream_stat();
+
+  /**
+   * @return int
+   */
+  public function stream_tell();
+
+  /**
+   * Truncate stream.
+   *
+   * Will respond to truncation; e.g., through ftruncate().
+   *
+   * @param int $new_size
+   *   The new size.
+   *
+   * @return bool
+   *   TRUE on success, FALSE otherwise.
+   */
+  public function stream_truncate($new_size);
+
+  /**
+   * @return int
+   */
+  public function stream_write($data);
+
+  /**
+   * @return bool
+   */
+  public function unlink($path);
+
+  /**
+   * @return array
+   */
+  public function url_stat($path, $flags);
 
-  public function unlink($uri);
-  public function rename($from_uri, $to_uri);
-  public function mkdir($uri, $mode, $options);
-  public function rmdir($uri, $options);
-  public function url_stat($uri, $flags);
-  public function dir_opendir($uri, $options);
-  public function dir_readdir();
-  public function dir_rewinddir();
-  public function dir_closedir();
 }
diff --git a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
index c45ef6e..c841444 100644
--- a/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/ReadOnlyStream.php
@@ -172,6 +172,14 @@ public function stream_metadata($uri, $option, $value) {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function stream_truncate($new_size) {
+    trigger_error('stream_truncate() not supported for read-only stream wrappers', E_USER_WARNING);
+    return FALSE;
+  }
+
+  /**
    * Support for unlink().
    *
    * The file will not be deleted from the stream as this is a read-only stream
