Skip to content

Change CGI::Cookie.new to Cookie.new#2335

Merged
ioquatix merged 2 commits intorack:2-2-stablefrom
jeremyevans:fix-22-cgi-cookie
May 22, 2025
Merged

Change CGI::Cookie.new to Cookie.new#2335
ioquatix merged 2 commits intorack:2-2-stablefrom
jeremyevans:fix-22-cgi-cookie

Conversation

@jeremyevans
Copy link
Copy Markdown
Contributor

Fixes #2334

@yahonda
Copy link
Copy Markdown

yahonda commented May 20, 2025

Confirmd that this pull request addresses the Rails CI errors NameError: uninitialized constant CGI::Cookie.

https://buildkite.com/rails/rails-nightly/builds/2248#0196ea59-3eab-4a37-bc05-24126a9ad23d/1181-2640

While I see these 3 tests are failing with Ruby 3.5.0dev.

$ ruby -v
ruby 3.5.0dev (2025-05-19T17:34:29Z master a7ef9a44a6) +PRISM [x86_64-linux]
$ bundle exec ruby -Itest test/spec_mock.rb
Run options: --seed 35143

# Running:

...........................F.....FF

Finished in 0.023080s, 1516.4772 runs/s, 6932.4670 assertions/s.

  1) Failure:
Rack::MockResponse#test_0005_provide access to persistent cookies [test/spec_mock.rb:306]:
--- expected
+++ actual
@@ -1 +1,3 @@
-"persistent_test"
+# encoding: ASCII-8BIT
+#    valid: true
+"p"


  2) Failure:
Rack::MockResponse#test_0004_provide access to session cookies [test/spec_mock.rb:295]:
--- expected
+++ actual
@@ -1 +1,3 @@
-"session_test"
+# encoding: ASCII-8BIT
+#    valid: true
+"s"


  3) Failure:
Rack::MockResponse#test_0006_provide access to secure cookies [test/spec_mock.rb:317]:
--- expected
+++ actual
@@ -1 +1,3 @@
-"secure_test"
+# encoding: ASCII-8BIT
+#    valid: true
+"s"


35 runs, 160 assertions, 3 failures, 0 errors, 0 skips
$

This was also missed in the 2.2-stable backport.
@jeremyevans
Copy link
Copy Markdown
Contributor Author

Found something else that was missed in the 2.2 backport, and pushed a commit for it. @yahonda, I apologize, but could you please check again and see if the additional commit fixed it?

@yahonda
Copy link
Copy Markdown

yahonda commented May 20, 2025

Confirmed 12195e9 addresses all of failures reported at #2335 (comment)

@jeremyevans
Copy link
Copy Markdown
Contributor Author

@yahonda Thank you very much for your quick testing of this PR.

@ioquatix It looks like these two changes were missed in the backport. I recommend merging this and releasing 2.2.16 with the changes.

@Earlopain
Copy link
Copy Markdown
Contributor

3-0-stable is also incomplete. It produces the same failures as in #2335 (comment) and needs 12195e9

It also still uses OpenStruct, so there are other failures on 3.5 since it is now gone for good. The same is also true for 2-2-stable. Should that be handled? For reference: #2004 #2166. It's not a problem for rails tests since some other dep pulls it in.

@ioquatix
Copy link
Copy Markdown
Member

Sorry folks it sounds like I did a poor job back-porting this fix. Let me take a closer look.

@ioquatix ioquatix merged commit 034a13c into rack:2-2-stable May 22, 2025
10 checks passed
@ioquatix ioquatix added this to the v2.2.16 milestone May 22, 2025
@ioquatix
Copy link
Copy Markdown
Member

Rack v2.2.16 is released with this PR. Let me know if there are other issues. I'll follow up with a v3.0.x release too if required.

@ioquatix
Copy link
Copy Markdown
Member

Rack v3.0.18 is released with the Array typecast. It looks like 3.1 is already okay.

@Earlopain
Copy link
Copy Markdown
Contributor

Thanks for taking care of it

@ioquatix
Copy link
Copy Markdown
Member

Sorry I some how dropped the ball on this one.

ismasan added a commit to starfederation/datastar-ruby that referenced this pull request Jan 14, 2026
Rack 3.1.x breaks on Ruby 4 because of missing cgi/cookie. Seems to be related to rack/rack#2335
ismasan added a commit to starfederation/datastar-ruby that referenced this pull request Jan 14, 2026
Rack 3.1.x breaks on Ruby 4 because of missing cgi/cookie. Seems to be related to rack/rack#2335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants