-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
-
None
-
Fully Compatible
irb(main):053:0> YAML.load(Regexp::Raw.new('x','s').to_yaml) Traceback (most recent call last): 16: from (irb):53 15: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych.rb:279:in `load' 14: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/nodes/node.rb:50:in `to_ruby' 13: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept' 12: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept' 11: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit' 10: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:313:in `visit_Psych_Nodes_Document' 9: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:32:in `accept' 8: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/visitor.rb:6:in `accept' 7: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/visitor.rb:16:in `visit' 6: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:208:in `visit_Psych_Nodes_Mapping' 5: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:394:in `revive' 4: from /home/w/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/visitors/to_ruby.rb:401:in `init_with' 3: from /home/w/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bson-4.9.0/lib/bson/regexp.rb:168:in `respond_to?' 2: from /home/w/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bson-4.9.0/lib/bson/regexp.rb:140:in `compile' 1: from /home/w/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bson-4.9.0/lib/bson/regexp.rb:253:in `options_to_int' NoMethodError (undefined method `include?' for nil:NilClass)
The issue appears to be that YAML.load calls respond_to? on the Regexp::Raw instance prior to the instance being initialized, and respond_to? then attempts to figure out integer regexp options from the string options but because the string options aren't set yet, this fails with an exception.
- is depended on by
-
MONGOID-4781 Make embedded matchers work the same as MongoDB server queries
- Released
- links to