Require cgi/escape instead of cgi#1825
Merged
xavdid-stripe merged 1 commit intostripe:masterfrom Mar 19, 2026
Merged
Conversation
stripe does not have a dependency on cgi. If you have stripe in your Gemfile, but not cgi, there is a verbose mode warning when requiring stripe on Ruby 4.0. Example file: ``` require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'stripe' gem 'logger' # Missing gem dependency on logger, different issue end require "stripe" ``` Running in verbose mode: ``` $ ruby -v t.rb ruby 4.0.2 (2026-03-17 revision d3da9fec82) +PRISM [x86_64-linux] /home/jeremy/.local/share/mise/installs/ruby/4.0.2/lib/ruby/gems/4.0.0/gems/stripe-18.4.2/lib/stripe.rb:5: warning: CGI library is removed from Ruby 4.0. Please use cgi/escape instead for CGI.escape and CGI.unescape features. If you need to use the full features of CGI library, Please install cgi gem. ``` The only cases in that are using a CGI method other than CGI.escape is in a couple tests using CGI.parse, so add cgi to the Gemfile and require cgi in those two test files. Switch the cgi require in lib to cgi/escape. This avoids the warning, and will avoid breakage in Ruby 4.1.
xavdid-stripe
approved these changes
Mar 19, 2026
Contributor
xavdid-stripe
left a comment
There was a problem hiding this comment.
awesome, thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
stripe does not have a dependency on cgi. If you have stripe in your Gemfile, but not cgi, there is a verbose mode warning when requiring stripe on Ruby 4.0. Example file:
Running in verbose mode:
The only cases in that are using a CGI method other than CGI.escape is in a couple tests using CGI.parse, so add cgi to the Gemfile and require cgi in those two test files. Switch the cgi require in lib to cgi/escape. This avoids the warning, and will avoid breakage in Ruby 4.1.