diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 4ebe881..f1f67f8 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -899,7 +899,7 @@ function drupal_get_filename($type, $name, $filename = NULL) {
     // Verify that we have an keyvalue service before using it. This is required
     // because this function is called during installation.
     // @todo Inject database connection into KeyValueStore\DatabaseStorage.
-    if (drupal_container()->has('keyvalue') && function_exists('db_query')) {
+    if (($container = drupal_container()) && $container->has('keyvalue') && function_exists('db_query')) {
       try {
         $file_list = state()->get('system.' . $type . '.files');
         if ($file_list && isset($file_list[$name]) && file_exists(DRUPAL_ROOT . '/' . $file_list[$name])) {
diff --git a/core/lib/Drupal/Component/Gettext/PoStreamReader.php b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
index 83ad207..f611fba 100644
--- a/core/lib/Drupal/Component/Gettext/PoStreamReader.php
+++ b/core/lib/Drupal/Component/Gettext/PoStreamReader.php
@@ -165,7 +165,7 @@ public function setURI($uri) {
    */
   public function open() {
     if (!empty($this->_uri)) {
-      $this->_fd = fopen(drupal_realpath($this->_uri), 'rb');
+      $this->_fd = fopen($this->_uri, 'rb');
       $this->_size = ftell($this->_fd);
       $this->readHeader();
     }
