diff --git a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php
index c6313b5..b0d4136 100644
--- a/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php
+++ b/core/modules/system/tests/modules/test_page_test/src/Controller/Test.php
@@ -66,7 +66,7 @@ public function controllerWithCache($mark_safe = FALSE) {
     if ($mark_safe) {
       $build['#title'] = SafeMarkup::checkPlain($build['#title']);
     }
-    $build['#cache']['keys'] = ['test_controller', 'with_title'];
+    $build['#cache']['keys'] = ['test_controller', 'with_title', $mark_safe];
 
     return $build;
   }
