diff --git a/misc/typo3/phar-stream-wrapper/src/PharStreamWrapper.php b/misc/typo3/phar-stream-wrapper/src/PharStreamWrapper.php
index 5a924e4ccd..2087ad00d2 100644
--- a/misc/typo3/phar-stream-wrapper/src/PharStreamWrapper.php
+++ b/misc/typo3/phar-stream-wrapper/src/PharStreamWrapper.php
@@ -140,13 +140,11 @@ class PharStreamWrapper
 
     /**
      * @param int $cast_as
+     * @return resource|false
      */
     public function stream_cast($cast_as)
     {
-        throw new Exception(
-            'Method stream_select() cannot be used',
-            1530103999
-        );
+        return $this->internalResource ? $this->internalResource : false;
     }
 
     public function stream_close()
