diff --git a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
index 1b14280..b532846 100644
--- a/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
+++ b/core/lib/Drupal/Core/StreamWrapper/LocalReadOnlyStream.php
@@ -40,7 +40,7 @@
    * @see http://php.net/manual/streamwrapper.stream-open.php
    */
   public function stream_open($uri, $mode, $options, &$opened_path) {
-    if ($mode != "r") {
+    if ($mode !== 'r' && $mode !== 'rb') {
       if ($options & STREAM_REPORT_ERRORS) {
         trigger_error('stream_open() write modes not supported for read-only stream wrappers', E_USER_WARNING);
       }
diff --git a/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
index 909fe1c..22afc7c 100644
--- a/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/File/ReadOnlyStreamWrapperTest.php
@@ -56,6 +56,10 @@ function testWriteFunctions() {
     // Attempt to open a file in write mode
     $handle = @fopen($uri, 'w+');
     $this->assertFalse($handle, 'Unable to open a file for writing with the read-only stream wrapper.');
+    // Attempt to open a file in binary read mode
+    $handle = fopen($uri, 'rb');
+    $this->assertTrue($handle, 'Able to open a file for reading in binary mode with the read-only stream wrapper.');
+    fclose($handle);
     // Attempt to open a file in read mode
     $handle = fopen($uri, 'r');
     $this->assertTrue($handle, 'Able to open a file for reading with the read-only stream wrapper.');
