From ec3056ae227fd79d706b2c6cdcdd8725df99c178 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Mon, 22 Oct 2012 21:09:56 +0000 Subject: * ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If something looks like a timestamp but has an invalid component, treat it as a string instead of throwing an ArgumentError. Thanks Rhett Sutphin! * test/psych/test_scalar_scanner.rb: appropriate tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/scalar_scanner.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ext/psych/lib/psych') diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb index 8727adecb4..ce4b767082 100644 --- a/ext/psych/lib/psych/scalar_scanner.rb +++ b/ext/psych/lib/psych/scalar_scanner.rb @@ -45,7 +45,11 @@ module Psych string end when TIME - parse_time string + begin + parse_time string + rescue ArgumentError + string + end when /^\d{4}-(?:1[012]|0\d|\d)-(?:[12]\d|3[01]|0\d|\d)$/ require 'date' begin -- cgit v1.2.3