diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 9dd3f56..ad6e088 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -2763,57 +2763,6 @@ function _current_path($path = NULL) {
 }
 
 /**
- * Returns a component of the current Drupal path.
- *
- * When viewing a page at the path "admin/structure/types", for example, arg(0)
- * returns "admin", arg(1) returns "structure", and arg(2) returns "types".
- *
- * Avoid use of this function where possible, as resulting code is hard to
- * read. In menu callback functions, attempt to use named arguments. See the
- * explanation in menu.inc for how to construct callbacks that take arguments.
- * When attempting to use this function to load an element from the current
- * path, e.g. loading the node on a node page, use menu_get_object() instead.
- *
- * @param $index
- *   The index of the component, where each component is separated by a '/'
- *   (forward-slash), and where the first component has an index of 0 (zero).
- * @param $path
- *   A path to break into components. Defaults to the path of the current page.
- *
- * @return
- *   The component specified by $index, or NULL if the specified component was
- *   not found. If called without arguments, it returns an array containing all
- *   the components of the current path.
- */
-function arg($index = NULL, $path = NULL) {
-  // Even though $arguments doesn't need to be resettable for any functional
-  // reasons (the result of explode() does not depend on any run-time
-  // information), it should be resettable anyway in case a module needs to
-  // free up the memory used by it.
-  // Use the advanced drupal_static() pattern, since this is called very often.
-  static $drupal_static_fast;
-  if (!isset($drupal_static_fast)) {
-    $drupal_static_fast['arguments'] = &drupal_static(__FUNCTION__);
-  }
-  $arguments = &$drupal_static_fast['arguments'];
-
-  if (!isset($path)) {
-    // @todo The public function current_path() is not available during early
-    //   bootstrap.
-    $path = _current_path();
-  }
-  if (!isset($arguments[$path])) {
-    $arguments[$path] = explode('/', $path);
-  }
-  if (!isset($index)) {
-    return $arguments[$path];
-  }
-  if (isset($arguments[$path][$index])) {
-    return $arguments[$path][$index];
-  }
-}
-
-/**
  * Initializes and returns the class loader.
  *
  * The class loader is responsible for lazy-loading all PSR-0 compatible
diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index a4f5e77..e496780 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -474,7 +474,7 @@ function menu_get_item($path = NULL, $router_item = NULL) {
     if (state()->get('menu_rebuild_needed') || !state()->get('menu.masks')) {
       menu_router_rebuild();
     }
-    $original_map = arg(NULL, $path);
+    $original_map = explode('/', $path);
 
     $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
     $ancestors = menu_get_ancestors($parts);
@@ -1722,7 +1722,7 @@ function menu_get_active_help() {
     return '';
   }
 
-  $arg = drupal_help_arg(arg(NULL));
+  $arg = drupal_help_arg(explode('/', Drupal::request()->attributes->get('system_path')));
 
   foreach (module_implements('help') as $module) {
     $function = $module . '_help';
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 70cce1e..462a3db 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2687,8 +2687,9 @@ function template_preprocess_html(&$variables) {
     $variables['attributes']['class'][] = 'no-sidebars';
   }
 
+  $path_args = explode('/', Drupal::request()->attributes->get('system_path'));
   // Populate the body classes.
-  if ($suggestions = theme_get_suggestions(arg(), 'page', '-')) {
+  if ($suggestions = theme_get_suggestions($path_args, 'page', '-')) {
     foreach ($suggestions as $suggestion) {
       if ($suggestion != 'page-front') {
         // Add current suggestion to page classes to make it possible to theme
@@ -2771,7 +2772,7 @@ function template_preprocess_html(&$variables) {
   }
 
   // Populate the page template suggestions.
-  if ($suggestions = theme_get_suggestions(arg(), 'html')) {
+  if ($suggestions = theme_get_suggestions($path_args, 'html')) {
     $variables['theme_hook_suggestions'] = $suggestions;
   }
 }
@@ -2864,7 +2865,7 @@ function template_preprocess_page(&$variables) {
   }
 
   // Populate the page template suggestions.
-  if ($suggestions = theme_get_suggestions(arg(), 'page')) {
+  if ($suggestions = theme_get_suggestions(explode('/', Drupal::request()->attributes->get('system_path')), 'page')) {
     $variables['theme_hook_suggestions'] = $suggestions;
   }
 }
diff --git a/core/modules/aggregator/aggregator.admin.inc b/core/modules/aggregator/aggregator.admin.inc
index f26d4ff..daeb02e 100644
--- a/core/modules/aggregator/aggregator.admin.inc
+++ b/core/modules/aggregator/aggregator.admin.inc
@@ -85,26 +85,14 @@ function aggregator_form_category_submit($form, &$form_state) {
   if (isset($form_state['values']['cid'])) {
     if (isset($form_state['values']['title'])) {
       drupal_set_message(t('The category %category has been updated.', array('%category' => $form_state['values']['title'])));
-      if (arg(0) == 'admin') {
-        $form_state['redirect'] = 'admin/config/services/aggregator/';
-        return;
-      }
-      else {
-        $form_state['redirect'] = 'aggregator/categories/' . $form_state['values']['cid'];
-        return;
-      }
+      $form_state['redirect'] = 'aggregator/categories/' . $form_state['values']['cid'];
+      return;
     }
     else {
       watchdog('aggregator', 'Category %category deleted.', array('%category' => $title));
       drupal_set_message(t('The category %category has been deleted.', array('%category' => $title)));
-      if (arg(0) == 'admin') {
-        $form_state['redirect'] = 'admin/config/services/aggregator/';
-        return;
-      }
-      else {
-        $form_state['redirect'] = 'aggregator/categories/';
-        return;
-      }
+      $form_state['redirect'] = 'aggregator/categories';
+      return;
     }
   }
   else {
diff --git a/core/modules/aggregator/aggregator.pages.inc b/core/modules/aggregator/aggregator.pages.inc
index 32509ce..df9757f 100644
--- a/core/modules/aggregator/aggregator.pages.inc
+++ b/core/modules/aggregator/aggregator.pages.inc
@@ -13,20 +13,22 @@
  *
  * @param \Drupal\aggregator\Plugin\Core\Entity\Feed $feed
  *   The feed for which to display all items.
+ * @param string $op
+ *   The operation to perform on items. Defaults to NULL.
  *
  * @return string
  *   The rendered list of items for the feed.
  *
  * @see aggregator_menu()
  */
-function aggregator_page_source(Feed $feed) {
+function aggregator_page_source(Feed $feed, $op = NULL) {
   $feed_source = entity_view($feed, 'default');
 
   // It is safe to include the fid in the query because it's loaded from the
   // database by aggregator_feed_load().
   $items = aggregator_load_feed_items('source', $feed);
 
-  return _aggregator_page_list($items, arg(3), $feed_source);
+  return _aggregator_page_list($items, $op, $feed_source);
 }
 
 /**
@@ -43,14 +45,16 @@ function aggregator_page_source(Feed $feed) {
  * @ingroup forms
  */
 function aggregator_page_source_form($form, $form_state, $feed) {
-  return aggregator_page_source($feed);
+  return aggregator_page_source($feed, 'categorize');
 }
 
 /**
  * Form constructor to list items aggregated in a category.
  *
- * @param $category
+ * @param string $category
  *   The category for which to list all of the aggregated items.
+ * @param string $op
+ *   The operation to perform on items. Defaults to NULL.
  *
  * @return string
  *   The rendered list of items for the feed.
@@ -58,14 +62,14 @@ function aggregator_page_source_form($form, $form_state, $feed) {
  * @see aggregator_menu()
  * @ingroup forms
  */
-function aggregator_page_category($category) {
+function aggregator_page_category($category, $op = NULL) {
   drupal_add_feed('aggregator/rss/' . $category->cid, config('system.site')->get('name') . ' ' . t('aggregator - @title', array('@title' => $category->title)));
 
   // It is safe to include the cid in the query because it's loaded from the
   // database by aggregator_category_load().
   $items = aggregator_load_feed_items('category', $category);
 
-  return _aggregator_page_list($items, arg(3));
+  return _aggregator_page_list($items, $op);
 }
 
 /**
@@ -82,7 +86,7 @@ function aggregator_page_category($category) {
  * @ingroup forms
  */
 function aggregator_page_category_form($form, $form_state, $category) {
-  return aggregator_page_category($category);
+  return aggregator_page_category($category, 'categorize');
 }
 
 /**
@@ -396,17 +400,20 @@ function aggregator_page_categories() {
 /**
  * Page callback: Generates an RSS 0.92 feed of aggregator items or categories.
  *
+ * @param int $cid
+ *  (optional) The category to display items from.
+ *
  * @return string
  *   An HTML formatted string.
  *
  * @see aggregator_menu()
  */
-function aggregator_page_rss() {
+function aggregator_page_rss($cid = NULL) {
   $result = NULL;
   $rss_config = config('system.rss');
-  // arg(2) is the passed cid, only select for that category.
-  if (arg(2)) {
-    $category = db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = :cid', array(':cid' => arg(2)))->fetchObject();
+  // If $cid is passed, only select for that category.
+  if ($cid) {
+    $category = db_query('SELECT cid, title FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $cid))->fetchObject();
     $result = db_query_range('SELECT i.*, f.title AS ftitle, f.link AS flink FROM {aggregator_category_item} c LEFT JOIN {aggregator_item} i ON c.iid = i.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE cid = :cid ORDER BY timestamp DESC, i.iid DESC', 0, $rss_config->get('items.limit'), array(':cid' => $category->cid));
   }
   // Or, get the default aggregator items.
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
index 1e77d7c..16f9d65 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedFormController.php
@@ -120,19 +120,14 @@ public function save(array $form, array &$form_state) {
       $feed->categories = $form_state['values']['category'];
     }
     $feed->save();
-    if ($insert) {
+    if (!$insert) {
       drupal_set_message(t('The feed %feed has been updated.', array('%feed' => $feed->label())));
-      if (arg(0) == 'admin') {
-        $form_state['redirect'] = 'admin/config/services/aggregator';
-      }
-      else {
-        $form_state['redirect'] = 'aggregator/sources/' . $feed->id();
-      }
     }
     else {
       watchdog('aggregator', 'Feed %feed added.', array('%feed' => $feed->label()), WATCHDOG_NOTICE, l(t('view'), 'admin/config/services/aggregator'));
       drupal_set_message(t('The feed %feed has been added.', array('%feed' => $feed->label())));
     }
+    $form_state['redirect'] = 'aggregator/sources/' . $feed->id();
   }
 
   /**
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDelete.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDelete.php
index d613c39..32d3bc0 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDelete.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/FeedDelete.php
@@ -65,11 +65,6 @@ public function submitForm(array &$form, array &$form_state) {
     $this->feed->delete();
     watchdog('aggregator', 'Feed %feed deleted.', array('%feed' => $this->feed->label()));
     drupal_set_message(t('The feed %feed has been deleted.', array('%feed' => $this->feed->label())));
-    if (arg(0) == 'admin') {
-      $form_state['redirect'] = 'admin/config/services/aggregator';
-    }
-    else {
-      $form_state['redirect'] = 'aggregator/sources';
-    }
+    $form_state['redirect'] = 'aggregator/sources';
   }
 }
diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php
index abef5af..0a5dcf7 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Routing/AggregatorController.php
@@ -147,10 +147,12 @@ public function adminOverview() {
       $links['edit'] = array(
         'title' => t('Edit'),
         'href' => "admin/config/services/aggregator/edit/feed/$feed->fid",
+        'query' => drupal_get_destination(),
       );
       $links['delete'] = array(
         'title' => t('Delete'),
         'href' => "admin/config/services/aggregator/delete/feed/$feed->fid",
+        'query' => drupal_get_destination(),
       );
       $links['remove'] = array(
         'title' => t('Remove items'),
@@ -189,6 +191,7 @@ public function adminOverview() {
       $links['edit'] = array(
         'title' => t('Edit'),
         'href' => "admin/config/services/aggregator/edit/category/$category->cid",
+        'query' => drupal_get_destination(),
       );
       $row[] = array(
         'data' => array(
@@ -225,6 +228,6 @@ public function pageLast() {
 
     // @todo Refactor this function once after all controller conversions are
     // done.
-    return _aggregator_page_list($items, arg(1));
+    return _aggregator_page_list($items, NULL);
   }
 }
diff --git a/core/modules/dblog/dblog.module b/core/modules/dblog/dblog.module
index 63e2b8f..7ecf140 100644
--- a/core/modules/dblog/dblog.module
+++ b/core/modules/dblog/dblog.module
@@ -87,7 +87,7 @@ function dblog_menu() {
  * Implements hook_page_build().
  */
 function dblog_page_build(&$page) {
-  if (arg(0) == 'admin' && arg(1) == 'reports') {
+  if (strpos(Drupal::request()->attributes->get('system_path'), 'admin/reports') === 0) {
     $page['#attached']['css'][] = drupal_get_path('module', 'dblog') . '/dblog.css';
   }
 }
diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module
index 42d7326..d690183 100644
--- a/core/modules/forum/forum.module
+++ b/core/modules/forum/forum.module
@@ -641,8 +641,8 @@ function forum_form_node_form_alter(&$form, &$form_state, $form_id) {
       // If there is no default forum already selected, try to get the forum
       // ID from the URL (e.g., if we are on a page like node/add/forum/2, we
       // expect "2" to be the ID of the forum that was requested).
-      $requested_forum_id = arg(3);
-      $form['taxonomy_forums'][$langcode]['#default_value'] = is_numeric($requested_forum_id) ? $requested_forum_id : '';
+      $args = explode('/', Drupal::request()->attributes->get('system_path'));
+      $form['taxonomy_forums'][$langcode]['#default_value'] = isset($args[3]) && is_numeric($args[3]) ? $args[3] : '';
     }
   }
 }
diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/argument_default/Node.php b/core/modules/node/lib/Drupal/node/Plugin/views/argument_default/Node.php
index 9e53ee8..819ec02 100644
--- a/core/modules/node/lib/Drupal/node/Plugin/views/argument_default/Node.php
+++ b/core/modules/node/lib/Drupal/node/Plugin/views/argument_default/Node.php
@@ -32,8 +32,9 @@ function get_argument() {
       }
     }
 
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      return arg(1);
+    $args = explode('/', \Drupal::request()->attributes->get('system_path'));
+    if (count($args) > 1 && $args[0] == 'node' && is_numeric($args[1])) {
+      return $args[1];
     }
   }
 
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 1aebdd5..3d5f1aa 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -1968,8 +1968,9 @@ function node_block_access($block) {
     }
     $node = menu_get_object();
     $node_types = node_type_get_types();
-    if (arg(0) == 'node' && arg(1) == 'add' && arg(2)) {
-      $node_add_arg = strtr(arg(2), '-', '_');
+    $args = explode('/', Drupal::request()->attributes->get('system_path'));
+    if (count($args) > 2 && $args[0] == 'node' && $args[1] == 'add') {
+      $node_add_arg = strtr($args[2], '-', '_');
     }
 
     // For blocks with node types associated, if the node type does not match
diff --git a/core/modules/system/tests/modules/form_test/form_test.module b/core/modules/system/tests/modules/form_test/form_test.module
index 63973aa..6c48e21 100644
--- a/core/modules/system/tests/modules/form_test/form_test.module
+++ b/core/modules/system/tests/modules/form_test/form_test.module
@@ -2134,7 +2134,8 @@ function form_test_clicked_button($form, &$form_state) {
   // 'image_button', and a 'button' with #access=FALSE. This enables form.test
   // to test a variety of combinations.
   $i=0;
-  $args = array_slice(arg(), 2);
+  $args = explode('/', Drupal::request()->attributes->get('system_path'));
+  $args = array_slice($args, 2);
   foreach ($args as $arg) {
     $name = 'button' . ++$i;
     // 's', 'b', or 'i' in the argument define the button type wanted.
diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module
index 4204077..3c6e323 100644
--- a/core/modules/system/tests/modules/theme_test/theme_test.module
+++ b/core/modules/system/tests/modules/theme_test/theme_test.module
@@ -74,7 +74,8 @@ function theme_test_menu() {
  * Implements hook_init().
  */
 function theme_test_init() {
-  if (arg(0) == 'theme-test' && arg(1) == 'hook-init') {
+  $path = Drupal::request()->attributes->get('system_path');
+  if ($path == 'theme-test/hook-init') {
     // First, force the theme registry to be rebuilt on this page request. This
     // allows us to test a full initialization of the theme system in the code
     // below.
@@ -85,7 +86,7 @@ function theme_test_init() {
     // still capable of returning output and theming the page as a whole.
     $GLOBALS['theme_test_output'] = theme('more_link', array('url' => 'user', 'title' => 'Themed output generated in hook_init()'));
   }
-  if (arg(0) == 'user' && arg(1) == 'autocomplete') {
+  if (strpos($path, 'user/autocomplete') === 0) {
     // Register a fake registry loading callback. If it gets called by
     // theme_get_registry(), the registry has not been initialized yet.
     _theme_registry_callback('_theme_test_load_registry', array());
diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
index 5e95072..9d0e864 100644
--- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
+++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/argument_default/Tid.php
@@ -120,8 +120,9 @@ public function submitOptionsForm(&$form, &$form_state, &$options = array()) {
   function get_argument() {
     // Load default argument from taxonomy page.
     if (!empty($this->options['term_page'])) {
-      if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
-        return arg(2);
+      $args = explode('/', \Drupal::request()->attributes->get('system_path'));
+      if ($args[0] == 'taxonomy' && $args[1] == 'term' && is_numeric($args[2])) {
+        return $args[2];
       }
     }
     // Load default argument from node.
diff --git a/core/modules/update/update.module b/core/modules/update/update.module
index ddbc398..e488ac9 100644
--- a/core/modules/update/update.module
+++ b/core/modules/update/update.module
@@ -99,8 +99,9 @@ function update_help($path, $arg) {
  * Implements hook_init().
  */
 function update_init() {
-  if (arg(0) == 'admin' && user_access('administer site configuration')) {
-    switch (current_path()) {
+  $path = Drupal::request()->attributes->get('system_path');
+  if (strpos($path, 'admin') === 0 && user_access('administer site configuration')) {
+    switch ($path) {
       // These pages don't need additional nagging.
       case 'admin/appearance/update':
       case 'admin/appearance/install':
diff --git a/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php b/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
index dd890bd..695e74a 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/Block/UserLoginBlock.php
@@ -26,7 +26,8 @@ class UserLoginBlock extends BlockBase {
    * Overrides \Drupal\block\BlockBase::access().
    */
   public function access() {
-    return (!$GLOBALS['user']->uid && !(arg(0) == 'user' && !is_numeric(arg(1))));
+    $args = explode('/', \Drupal::request()->attributes->get('system_path'));
+    return (!$GLOBALS['user']->uid && !(count($args) > 1 && $args[0] == 'user' && !is_numeric($args[1])));
   }
 
   /**
diff --git a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
index 360ec9d..86fdef7 100644
--- a/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
+++ b/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/User.php
@@ -61,15 +61,18 @@ function get_argument() {
       }
     }
 
-    if (arg(0) == 'user' && is_numeric(arg(1))) {
-      return arg(1);
-    }
+    $args = explode('/', \Drupal::request()->attributes->get('system_path'));
+    if (count($args) > 1) {
+      if ($args[0] == 'user' && is_numeric($args[1])) {
+        return $args[1];
+      }
 
-    if (!empty($this->options['user'])) {
-      if (arg(0) == 'node' && is_numeric(arg(1))) {
-        $node = node_load(arg(1));
-        if ($node) {
-          return $node->uid;
+      if (!empty($this->options['user'])) {
+        if ($args[0] == 'node' && is_numeric($args[1])) {
+          $node = node_load($args[1]);
+          if ($node) {
+            return $node->uid;
+          }
         }
       }
     }
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument/Date.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument/Date.php
index fefd5d1..406ffe3 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument/Date.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument/Date.php
@@ -69,8 +69,9 @@ public function getDefaultArgument($raw = FALSE) {
         }
       }
 
-      if (arg(0) == 'node' && is_numeric(arg(1))) {
-        $node = node_load(arg(1));
+      $args = explode('/', \Drupal::request()->attributes->get('system_path'));
+      if (count($args) > 1 && $args[0] == 'node' && is_numeric($args[1])) {
+        $node = node_load($args[1]);
       }
 
       if (empty($node)) {
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php b/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php
index a2a6290..a4c1ecb 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/argument_default/Raw.php
@@ -54,8 +54,12 @@ function get_argument() {
     if ($this->options['use_alias']) {
       $path = drupal_get_path_alias();
     }
-    if ($arg = arg($this->options['index'], $path)) {
-      return $arg;
+    if (!$path) {
+      $path = \Drupal::request()->attributes->get('system_path');
+    }
+    $args = explode('/', $path);
+    if (isset($args[$this->options['index']])) {
+      return $args[$this->options['index']];
     }
   }
 
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index 7f6b104..421777f 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -2697,7 +2697,7 @@ public function getSpecialBlocks() {
    */
   public function viewExposedFormBlocks() {
     // avoid interfering with the admin forms.
-    if (arg(0) == 'admin' && arg(1) == 'structure' && arg(2) == 'views') {
+    if (strpos(\Drupal::request()->attributes->get('system_path'), 'admin/structure/views') === 0) {
       return;
     }
     $this->view->initHandlers();
