[ruby-core:92334] [Ruby trunk Bug#15776] Difference between Time.parse behaviour between 2.6.0 and 2.6.1+

From: mame@...
Date: 2019-04-19 21:08:15 UTC
List: ruby-core #92334
Issue #15776 has been updated by mame (Yusuke Endoh).

Assignee set to nobu (Nobuyoshi Nakada)
Status changed from Open to Assigned

By bisecting, I found this caused by r66735 which was for [Bug #15506].  I'm unsure what behavior is correct, but I recommend not to depend upon such a behavior of corner cases of Time.parse.

----------------------------------------
Bug #15776: Difference between Time.parse behaviour between 2.6.0 and 2.6.1+
https://bugs.ruby-lang.org/issues/15776#change-77676

* Author: budmc29 (Mugurel Chirica)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 
* ruby -v: 2.6.1
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
There is currently a major parsing difference ruby 2.6.0 and 2.6.1+ which affects time validation logic.

Ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin17] behaviour:
```
irb(main):001:0> require 'time'
irb(main):002:0> Time.parse('123')
Traceback (most recent call last): (...)
ArgumentError (argument out of range)
```

Ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17]

```
irb(main):001:0> require 'time'
=> true
irb(main):002:0> Time.parse('123')
=> 2019-05-03 00:00:00 +0100
```

Expected behaviour is for `Time.parse('123')` to raise an exception because the information provided is not enough to properly parse it.

This is the same behaviour on previous versions of Ruby before 2.6.

I couldn't fine anything new added to the docs for ::parse to explain this change.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next