Closed jrafanie closed 2 weeks ago
Looking at the diff from 0.13.1 to 1.0.0, I don't see this warning even with -W2 or --verbose.
def self.const_missing(const)
if value = RFC2396_PARSER.regexp[const]
warn "URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
value
else
super
end
Please let me know why I'm not receiving the warning and what we should be using instead of URI::PATTERN. Should we be using URI::RFC2396_REGEXP::PATTERN
?
I see that URI::REGEXP was also removed without a deprecation warning.
% ruby -e "puts RUBY_VERSION; require 'uri'; puts URI::VERSION; puts URI::REGEXP"
3.3.5
1.0.0
/Users/joerafaniello/.gem/ruby/3.3.5/gems/uri-1.0.0/lib/uri/common.rb:53:in `const_missing': uninitialized constant URI::REGEXP (NameError)
This worked in many prior rubies.
% podman run --rm -e "ALL_RUBY_SHOW_DUP=yes" -e "ALL_RUBY_SINCE=ruby-2.6" -e "ALL_RUBY_ADDBINS=/usr/bin/ruby" rubylang/all-ruby ./all-ruby -e 'require "uri"; puts "version: #{URI::VERSION} parser: #{URI::REGEXP}"'
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
ruby-2.6.0 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.1 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.2 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.3 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.4 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.5 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.6 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.7 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.8 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.9 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.6.10 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.0-preview1 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.0-preview2 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.0-preview3 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.0-rc1 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.0-rc2 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.0 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.1 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.2 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.3 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.4 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.5 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.6 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.7 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-2.7.8 version: 0.10.0.2 parser: URI::RFC2396_REGEXP
ruby-3.0.0-preview1 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-3.0.0-preview2 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-3.0.0-rc1 version: 0.10.0 parser: URI::RFC2396_REGEXP
ruby-3.0.0 version: 0.10.1 parser: URI::RFC2396_REGEXP
ruby-3.0.1 version: 0.10.1 parser: URI::RFC2396_REGEXP
ruby-3.0.2 version: 0.10.1 parser: URI::RFC2396_REGEXP
ruby-3.0.3 version: 0.10.1 parser: URI::RFC2396_REGEXP
ruby-3.0.4 version: 0.10.1 parser: URI::RFC2396_REGEXP
ruby-3.0.5 version: 0.10.1 parser: URI::RFC2396_REGEXP
ruby-3.0.6 version: 0.10.2 parser: URI::RFC2396_REGEXP
ruby-3.0.7 version: 0.10.3 parser: URI::RFC2396_REGEXP
ruby-3.1.0-preview1 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.1.0 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.1.1 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.1.2 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.1.3 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.1.4 version: 0.12.1 parser: URI::RFC2396_REGEXP
ruby-3.1.5 version: 0.12.2 parser: URI::RFC2396_REGEXP
ruby-3.1.6 version: 0.12.2 parser: URI::RFC2396_REGEXP
ruby-3.2.0-preview1 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.2.0-preview2 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.2.0-preview3 version: 0.11.0 parser: URI::RFC2396_REGEXP
ruby-3.2.0-rc1 version: 0.12.0 parser: URI::RFC2396_REGEXP
ruby-3.2.0 version: 0.12.0 parser: URI::RFC2396_REGEXP
ruby-3.2.1 version: 0.12.0 parser: URI::RFC2396_REGEXP
ruby-3.2.2 version: 0.12.1 parser: URI::RFC2396_REGEXP
ruby-3.2.3 version: 0.12.2 parser: URI::RFC2396_REGEXP
ruby-3.2.4 version: 0.12.2 parser: URI::RFC2396_REGEXP
ruby-3.2.5 version: 0.12.2 parser: URI::RFC2396_REGEXP
ruby-3.2.6 version: 0.12.3 parser: URI::RFC2396_REGEXP
ruby-3.3.0-preview1 version: 0.12.1 parser: URI::RFC2396_REGEXP
ruby-3.3.0-preview2 version: 0.12.2 parser: URI::RFC2396_REGEXP
ruby-3.3.0-preview3 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.0-rc1 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.0 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.1 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.2 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.3 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.4 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.3.5 version: 0.13.1 parser: URI::RFC2396_REGEXP
ruby-3.3.6 version: 0.13.1 parser: URI::RFC2396_REGEXP
ruby-3.4.0-preview1 version: 0.13.0 parser: URI::RFC2396_REGEXP
ruby-3.4.0-preview2 /build-all-ruby/3.4.0-preview2/lib/ruby/3.4.0+0/uri/common.rb:53:in 'URI.const_missing': uninitialized constant URI::REGEXP (NameError)
Did you mean? Regexp
from -e:1:in '<main>'
Can confirm the above, receiving same:
NameError: uninitialized constant URI::REGEXP (NameError)
Thank you for reporting this.
I fixed at https://github.com/ruby/uri/commit/1f3d3df02a0ff764e9a8a80c8d9e2c1e2d11bdce. And released 1.0.1 with that fix.
Thank you @hsbt! Using 1.0.1, with warnings enabled, I'm now seeing the warnings for these two constants but it continues to work as it did in earlier versions. Looks good to me. Thank you for the quick response!
Thanks in advance for your work on this library.
URI::PATTERN constant has existed for a long time, since at least ruby 2.1/ URI 0.9.11. It looks like URI 1.0.0 dropped it without deprecating it. Was this intentional?
Running all-ruby, we can see it's been there a long time. If we can't use it, please deprecate it and suggest a replacement. Thanks!