From 7427d2c236decf02cb8d48fe068704fce2e9761e Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 30 Aug 2024 20:06:26 -0600 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=9A=A8=20warning:=20constant=20::Bign?= =?UTF-8?q?um=20is=20deprecated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fixnum & Bignum were unified into Integer in Ruby 2.4.0 Ref: https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/ --- test/test_cryptutil.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_cryptutil.rb b/test/test_cryptutil.rb index 2f272545..33c83cf8 100644 --- a/test/test_cryptutil.rb +++ b/test/test_cryptutil.rb @@ -8,14 +8,14 @@ class CryptUtilTestCase < Minitest::Test def test_rand # If this is not true, the rest of our test won't work - assert(BIG.is_a?(Bignum)) + assert(BIG.is_a?(Integer)) # It's possible that these will be small enough for fixnums, but # extraorindarily unlikely. a = OpenID::CryptUtil.rand(BIG) b = OpenID::CryptUtil.rand(BIG) - assert(a.is_a?(Bignum)) - assert(b.is_a?(Bignum)) + assert(a.is_a?(Integer)) + assert(b.is_a?(Integer)) refute_equal(a, b) end From c4bb12fbbd29c2028792d009f29a68300ddd89d7 Mon Sep 17 00:00:00 2001 From: tsaitgaist Date: Wed, 27 Oct 2021 18:34:08 +0200 Subject: [PATCH 2/2] server: fix param length check for decode in the redmine plugin buri17/redmine_openid_provider, the following call: app/controllers/open_id_provider_controller.rb:28 open_id_request = server.decode_request(params) causes the following exception: NoMethodError (undefined method `length' for #) params is a ActionController::Parameters. in rails 4.x ActionController::Parameters was a Hash and had the length method. in rails 5.x ActionController::Parameters is an object and does not have the length method. instead the empty? method can be used. this fix replaces "params.length == 0" with the equivalent "params.empty?" --- lib/openid/server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/openid/server.rb b/lib/openid/server.rb index 8fa1513d..6589495c 100644 --- a/lib/openid/server.rb +++ b/lib/openid/server.rb @@ -1240,7 +1240,7 @@ def initialize(server) # Raises ProtocolError when the query does not seem to be a valid # OpenID request. def decode(query) - if query.nil? or query.length == 0 + if query.nil? or query.empty? return nil end