diff --git a/actionpack/lib/action_dispatch/middleware/flash.rb b/actionpack/lib/action_dispatch/middleware/flash.rb
index <HASH>..<HASH> 100644
--- a/actionpack/lib/action_dispatch/middleware/flash.rb
+++ b/actionpack/lib/action_dispatch/middleware/flash.rb
@@ -132,7 +132,7 @@ module ActionDispatch
       end
 
       def key?(name)
-        @flashes.key? name
+        @flashes.key? name.to_s
       end
 
       def delete(key)
diff --git a/actionpack/test/controller/flash_hash_test.rb b/actionpack/test/controller/flash_hash_test.rb
index <HASH>..<HASH> 100644
--- a/actionpack/test/controller/flash_hash_test.rb
+++ b/actionpack/test/controller/flash_hash_test.rb
@@ -29,6 +29,15 @@ module ActionDispatch
       assert_equal 'world', @hash['hello']
     end
 
+    def test_key
+      @hash['foo'] = 'bar'
+
+      assert @hash.key?('foo')
+      assert @hash.key?(:foo)
+      assert_not @hash.key?('bar')
+      assert_not @hash.key?(:bar)
+    end
+
     def test_delete
       @hash['foo'] = 'bar'
       @hash.delete 'foo'
Make FlashHash#key? work with symbol and string

Closes #<I>