Bug #752 [ruby-core:19919]

YAML::load has problems with older dates

Added by David Welton 232 days ago. Updated 151 days ago.

Status :Closed Start :11/14/2008
Priority :Normal Due date :
Assigned to :Yukihiro Matsumoto % Done :

100%

Category :-
Target version :-
ruby -v :


Description

irb(main):002:0> require 'yaml'
=> true
irb(main):003:0> YAML::load('1900-01-01T00:00:00+00:00')
ArgumentError: time out of range
	from /usr/lib/ruby/1.8/yaml.rb:133:in `utc'
	from /usr/lib/ruby/1.8/yaml.rb:133:in `node_import'
	from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
	from /usr/lib/ruby/1.8/yaml.rb:133:in `load'
	from (irb):3
	from /usr/lib/ruby/1.8/date.rb:461

There is no reason dates like that shouldn't work.

yaml_datetime.diff - yaml datetime patch (2.8 KB) David Welton, 11/14/2008 01:04 AM

History

11/14/2008 01:04 AM - David Welton

Here is a patch that fixes the problem.  It's likely to slow things down some, because DateTime is not fast, but at least it doesn't crash...

02/03/2009 11:21 AM - Shyouhei Urabe

  • Status changed from Open to Closed
  • Assigned to set to Yukihiro Matsumoto
  • % Done changed from 0 to 100
This issue has been fixed in the repository.

Also available in: Atom PDF