[ruby-core:95944] [Ruby master Bug#16368] Error in `YAML.load(symbolize_names: true)` with null column YAML

[email protected]
Newsgroups gmane.comp.lang.ruby.core
Message-ID <redmine.issue-16368.20191125201905.bb989eaaf1a6216d@ruby-lang.org>
Issue #16368 has been reported by kibitan (Chikahiro Tokoro).

----------------------------------------
Bug #16368: Error in `YAML.load(symbolize_names: true)` with null column YAML
https://bugs.ruby-lang.org/issues/16368

* Author: kibitan (Chikahiro Tokoro)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0preview2 (2019-10-22 master 02aadf1032) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Trying to parse YAML which contains null column `symbolize_names: true` would raise `NoMethodError`


```
irb(main):001:0> require 'yaml'
=> true
irb(main):002:0> YAML.load("null: nullnull")
=> {nil=>"nullnull"}
irb(main):003:0> YAML.load("null: nullnull", symbolize_names: true)
Traceback (most recent call last):
        8: from /usr/local/bin/irb:23:in `<main>'
        7: from /usr/local/bin/irb:23:in `load'
        6: from /usr/local/lib/ruby/gems/2.7.0/gems/irb-1.1.0.pre.3/exe/irb:11:in `<top (required)>'
        5: from (irb):4
        4: from /usr/local/lib/ruby/2.7.0/psych.rb:276:in `load'
        3: from /usr/local/lib/ruby/2.7.0/psych.rb:606:in `symbolize_names!'
        2: from /usr/local/lib/ruby/2.7.0/psych.rb:606:in `each'
        1: from /usr/local/lib/ruby/2.7.0/psych.rb:607:in `block in symbolize_names!'
NoMethodError (undefined method `to_sym' for nil:NilClass
```


I also send a pull request for related repo.
https://github.com/ruby/psych/pull/423



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.