diff options
author | Jean Boussier <[email protected]> | 2021-11-15 11:37:40 +0100 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2021-11-16 22:51:40 +0900 |
commit | fa674cf7230e40bc96625ee97a6057e48bb20f0f (patch) | |
tree | 6bc5522936e2bd9086ac12c588a4f507ed7b5298 /ext/date/date_core.c | |
parent | 17e64cca6b737060884f6fd9ab1c5055e9b49577 (diff) |
[ruby/date] `Date._<format>(nil)` should return an empty Hash
Fix: https://github.com/ruby/date/issues/39
This is how versions previous to 3.2.1 behaved and Active Support
currently rely on this behavior.
https://github.com/rails/rails/blob/90357af08048ef5076730505f6e7b14a81f33d0c/activesupport/lib/active_support/values/time_zone.rb#L383-L384
Any Rails application upgrading to date `3.2.1` might run into unexpected errors.
https://github.com/ruby/date/commit/8f2d7a0c7e
Diffstat (limited to 'ext/date/date_core.c')
-rw-r--r-- | ext/date/date_core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index e372a12cd7..d1d03fe407 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -4342,6 +4342,8 @@ get_limit(VALUE opt) static void check_limit(VALUE str, VALUE opt) { + if (NIL_P(str)) return; + StringValue(str); size_t slen = RSTRING_LEN(str); size_t limit = get_limit(opt); |